From: Fabio Estevam Date: Wed, 26 Feb 2014 23:53:42 +0000 (-0300) Subject: imx-drm: parallel-display: Check 'mode' pointer first X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=39dcf4f708992318ba331319a69ff77db4e70864;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Fabio Estevam Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/imx-drm/parallel-display.c b/drivers/staging/imx-drm/parallel-display.c index 6bce1405efd2..c60b6c645f42 100644 --- a/drivers/staging/imx-drm/parallel-display.c +++ b/drivers/staging/imx-drm/parallel-display.c @@ -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,