drm/imx: parallel-display: check return code from of_get_drm_display_mode()
authorLothar Waßmann <LW@KARO-electronics.de>
Tue, 12 Jul 2016 13:30:01 +0000 (15:30 +0200)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Tue, 12 Jul 2016 16:26:06 +0000 (18:26 +0200)
of_get_drm_display_mode() may fail. Check its return code and bail out
on error.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/gpu/drm/imx/parallel-display.c

index 7b7bb31008319562bcb8d960e8e954ca6c3ceecb..4abac21c5c9bbc0751df61f22bc8f1eaca020b37 100644 (file)
@@ -73,10 +73,16 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
 
        if (np) {
                struct drm_display_mode *mode = drm_mode_create(connector->dev);
+               int ret;
 
                if (!mode)
                        return -EINVAL;
-               of_get_drm_display_mode(np, &imxpd->mode, OF_USE_NATIVE_MODE);
+
+               ret = of_get_drm_display_mode(np, &imxpd->mode,
+                                             OF_USE_NATIVE_MODE);
+               if (ret)
+                       return ret;
+
                drm_mode_copy(mode, &imxpd->mode);
                mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
                drm_mode_probed_add(connector, mode);