[PATCH 03/17] drm/imx: parallel-display: move panel/bridge detection to fail early

Marco Felsch m.felsch at pengutronix.de
Thu Feb 27 16:21:11 UTC 2020


We do some string parsing and string comparison in front of
drm_of_find_panel_or_bridge(). All this work is useless if the call
fails. Move drm_of_find_panel_or_bridge() infront of the parsing work to
fail early.

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel at pengutronix.de>
---
 drivers/gpu/drm/imx/parallel-display.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c
index 1f08fe8337d7..6ee028faa9a8 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -200,6 +200,11 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
 	if (!imxpd)
 		return -ENOMEM;
 
+	/* port at 1 is the output port */
+	ret = drm_of_find_panel_or_bridge(np, 1, 0, &imxpd->panel, &imxpd->bridge);
+	if (ret && ret != -ENODEV)
+		return ret;
+
 	edidp = of_get_property(np, "edid", &imxpd->edid_len);
 	if (edidp)
 		imxpd->edid = devm_kmemdup(dev, edidp, imxpd->edid_len,
@@ -218,10 +223,6 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
 	}
 	imxpd->bus_format = bus_format;
 
-	/* port at 1 is the output port */
-	ret = drm_of_find_panel_or_bridge(np, 1, 0, &imxpd->panel, &imxpd->bridge);
-	if (ret && ret != -ENODEV)
-		return ret;
 
 	imxpd->dev = dev;
 
-- 
2.20.1



More information about the dri-devel mailing list