otm8009a_prepare() enables ctx->supply then runs otm8009a_init_sequence();
on init failure it returns directly, leaking the supply (unprepare disables
it). Route through a disable_supply label.

Fixes: f0a5bb9803a9 ("drm/panel: Add support for OTM8009A panel driver")
Signed-off-by: Tang Bin <[email protected]>
---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c 
b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index 130520558..49cac3012 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -281,11 +281,15 @@ static int otm8009a_prepare(struct drm_panel *panel)
 
        ret = otm8009a_init_sequence(ctx);
        if (ret)
-               return ret;
+               goto disable_supply;
 
        ctx->prepared = true;
 
        return 0;
+
+disable_supply:
+       regulator_disable(ctx->supply);
+       return ret;
 }
 
 static int otm8009a_enable(struct drm_panel *panel)
-- 
2.52.0.windows.1



Reply via email to