]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/bridge: anx7625: Zero error variable when panel bridge not present
authorNícolas F. R. A. Prado <nfraprado@collabora.com>
Mon, 13 Jun 2022 16:37:05 +0000 (12:37 -0400)
committerRobert Foss <robert.foss@linaro.org>
Wed, 15 Jun 2022 16:03:44 +0000 (18:03 +0200)
While parsing the DT, the anx7625 driver checks for the presence of a
panel bridge on endpoint 1. If it is missing, pdata->panel_bridge stores
the error pointer and the function returns successfully without first
cleaning that variable. This is an issue since other functions later
check for the presence of a panel bridge by testing the trueness of that
variable.

In order to ensure proper behavior, zero out pdata->panel_bridge before
returning when no panel bridge is found.

Fixes: 11180e59c868 ("drm/bridge: anx7625: switch to devm_drm_of_get_bridge")
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220613163705.1531721-1-nfraprado@collabora.com
drivers/gpu/drm/bridge/analogix/anx7625.c

index bbdca16db0d671c2b444a528127dc046bf793c5b..f08f3307079e097a35253e1f4b842ed1aa2cf4fb 100644 (file)
@@ -1658,8 +1658,10 @@ static int anx7625_parse_dt(struct device *dev,
 
        pdata->panel_bridge = devm_drm_of_get_bridge(dev, np, 1, 0);
        if (IS_ERR(pdata->panel_bridge)) {
-               if (PTR_ERR(pdata->panel_bridge) == -ENODEV)
+               if (PTR_ERR(pdata->panel_bridge) == -ENODEV) {
+                       pdata->panel_bridge = NULL;
                        return 0;
+               }
 
                return PTR_ERR(pdata->panel_bridge);
        }