renesas_r61307_prepare() enables vcc_supply then iovcc_supply; on iovcc
failure it returns directly, leaking vcc_supply (the matching unprepare
disables both). Route through a disable_vcc label.

Fixes: cb6c01ead1eb ("drm: panel: Add support for Renesas R61307 based MIPI DSI 
panel")
Signed-off-by: Tang Bin <[email protected]>
---
 drivers/gpu/drm/panel/panel-renesas-r61307.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-renesas-r61307.c 
b/drivers/gpu/drm/panel/panel-renesas-r61307.c
index 53556452e..0aed970d8 100644
--- a/drivers/gpu/drm/panel/panel-renesas-r61307.c
+++ b/drivers/gpu/drm/panel/panel-renesas-r61307.c
@@ -100,7 +100,7 @@ static int renesas_r61307_prepare(struct drm_panel *panel)
        ret = regulator_enable(priv->iovcc_supply);
        if (ret) {
                dev_err(dev, "failed to enable iovcc power supply\n");
-               return ret;
+               goto disable_vcc;
        }
 
        usleep_range(2000, 3000);
@@ -108,6 +108,10 @@ static int renesas_r61307_prepare(struct drm_panel *panel)
        renesas_r61307_reset(priv);
 
        return 0;
+
+disable_vcc:
+       regulator_disable(priv->vcc_supply);
+       return ret;
 }
 
 static int renesas_r61307_enable(struct drm_panel *panel)
-- 
2.52.0.windows.1



Reply via email to