mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-28 21:45:01 +08:00
imx-drm: parallel-display: Check 'mode' pointer first
Fix the following static checker warnings: drivers/staging/imx-drm/parallel-display.c:64 imx_pd_connector_get_modes() error: potential null dereference 'mode'. (drm_mode_create returns null) drivers/staging/imx-drm/parallel-display.c:73 imx_pd_connector_get_modes() error: potential null dereference 'mode'. (drm_mode_create returns null) Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9f9b036f0e
commit
39dcf4f708
@ -70,6 +70,8 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
|
||||
|
||||
if (imxpd->mode_valid) {
|
||||
struct drm_display_mode *mode = drm_mode_create(connector->dev);
|
||||
if (!mode)
|
||||
return -EINVAL;
|
||||
drm_mode_copy(mode, &imxpd->mode);
|
||||
mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
|
||||
drm_mode_probed_add(connector, mode);
|
||||
@ -78,6 +80,8 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
|
||||
|
||||
if (np) {
|
||||
struct drm_display_mode *mode = drm_mode_create(connector->dev);
|
||||
if (!mode)
|
||||
return -EINVAL;
|
||||
of_get_drm_display_mode(np, &imxpd->mode, OF_USE_NATIVE_MODE);
|
||||
drm_mode_copy(mode, &imxpd->mode);
|
||||
mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
|
||||
|
Loading…
Reference in New Issue
Block a user