From: Osama Abdelkader <osama.abdelkader@gmail.com>
To: Anitha Chrisanthus <anitha.chrisanthus@intel.com>,
Edmund Dea <edmund.j.dea@intel.com>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Osama Abdelkader <osama.abdelkader@gmail.com>
Subject: [PATCH 2/2] drm/kmb: unwind partially enabled DSI clocks on error
Date: Mon, 20 Apr 2026 17:06:58 +0200 [thread overview]
Message-ID: <20260420150658.165734-2-osama.abdelkader@gmail.com> (raw)
In-Reply-To: <20260420150658.165734-1-osama.abdelkader@gmail.com>
If enabling clk_mipi_ecfg or clk_mipi_cfg fails, disable any clocks that
were successfully prepared/enabled earlier in kmb_dsi_clk_enable().
This avoids leaking enabled clocks on probe failure paths.
Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
---
drivers/gpu/drm/kmb/kmb_dsi.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/kmb/kmb_dsi.c b/drivers/gpu/drm/kmb/kmb_dsi.c
index 500dc00ba6ae..3ec16b1aa16c 100644
--- a/drivers/gpu/drm/kmb/kmb_dsi.c
+++ b/drivers/gpu/drm/kmb/kmb_dsi.c
@@ -1526,17 +1526,23 @@ static int kmb_dsi_clk_enable(struct kmb_dsi *kmb_dsi)
ret = clk_prepare_enable(kmb_dsi->clk_mipi_ecfg);
if (ret) {
dev_err(dev, "Failed to enable MIPI_ECFG clock: %d\n", ret);
- return ret;
+ goto err_disable_mipi;
}
ret = clk_prepare_enable(kmb_dsi->clk_mipi_cfg);
if (ret) {
dev_err(dev, "Failed to enable MIPI_CFG clock: %d\n", ret);
- return ret;
+ goto err_disable_mipi_ecfg;
}
dev_info(dev, "SUCCESS : enabled MIPI clocks\n");
return 0;
+
+err_disable_mipi_ecfg:
+ clk_disable_unprepare(kmb_dsi->clk_mipi_ecfg);
+err_disable_mipi:
+ clk_disable_unprepare(kmb_dsi->clk_mipi);
+ return ret;
}
int kmb_dsi_clk_init(struct kmb_dsi *kmb_dsi)
--
2.43.0
prev parent reply other threads:[~2026-04-20 15:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 15:06 [PATCH 1/2] drm/kmb: reset DSI host singleton state on teardown Osama Abdelkader
2026-04-20 15:06 ` Osama Abdelkader [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260420150658.165734-2-osama.abdelkader@gmail.com \
--to=osama.abdelkader@gmail.com \
--cc=airlied@gmail.com \
--cc=anitha.chrisanthus@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=edmund.j.dea@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=simona@ffwll.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox