drm/imx: imx-ldb: check return code on panel attach
authorLucas Stach <l.stach@pengutronix.de>
Thu, 16 Jun 2016 09:12:13 +0000 (11:12 +0200)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Tue, 12 Jul 2016 16:24:29 +0000 (18:24 +0200)
Check the return code on panel attach. Avoids a kernel crash later
on if the attach failed.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/gpu/drm/imx/imx-ldb.c

index 00d67b5407d8d6833d1ca8429134323a742a90bf..5d2831dfb8b9842acff6dd194337fee8bacee1f7 100644 (file)
@@ -474,8 +474,12 @@ static int imx_ldb_register(struct drm_device *drm,
        drm_connector_init(drm, &imx_ldb_ch->connector,
                           &imx_ldb_connector_funcs, DRM_MODE_CONNECTOR_LVDS);
 
-       if (imx_ldb_ch->panel)
-               drm_panel_attach(imx_ldb_ch->panel, &imx_ldb_ch->connector);
+       if (imx_ldb_ch->panel) {
+               ret = drm_panel_attach(imx_ldb_ch->panel,
+                                      &imx_ldb_ch->connector);
+               if (ret)
+                       return ret;
+       }
 
        drm_mode_connector_attach_encoder(&imx_ldb_ch->connector, encoder);