The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] drm/sun4i: mixer: Check clock enable failures
@ 2026-06-24  5:51 Pengpeng Hou
  2026-06-27  6:36 ` Jernej Škrabec
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-06-24  5:51 UTC (permalink / raw)
  To: Chen-Yu Tsai, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Samuel Holland,
	dri-devel
  Cc: linux-arm-kernel, linux-sunxi, linux-kernel, Pengpeng Hou

sun8i_mixer_bind() acquires the required bus and module clocks, but
ignores clk_prepare_enable() failures before adding the mixer engine to
the DRM pipeline.

Check both clock enable operations and use the existing unwind labels
when a required clock cannot be enabled.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/gpu/drm/sun4i/sun8i_mixer.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index ce9c155bfad7..c6546f933b13 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -616,7 +616,11 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
 		ret = PTR_ERR(mixer->bus_clk);
 		goto err_assert_reset;
 	}
-	clk_prepare_enable(mixer->bus_clk);
+	ret = clk_prepare_enable(mixer->bus_clk);
+	if (ret) {
+		dev_err(dev, "Couldn't enable the mixer bus clock\n");
+		goto err_assert_reset;
+	}
 
 	mixer->mod_clk = devm_clk_get(dev, "mod");
 	if (IS_ERR(mixer->mod_clk)) {
@@ -633,7 +637,11 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
 	if (mixer->cfg->mod_rate)
 		clk_set_rate(mixer->mod_clk, mixer->cfg->mod_rate);
 
-	clk_prepare_enable(mixer->mod_clk);
+	ret = clk_prepare_enable(mixer->mod_clk);
+	if (ret) {
+		dev_err(dev, "Couldn't enable the mixer module clock\n");
+		goto err_disable_bus_clk;
+	}
 
 	list_add_tail(&mixer->engine.list, &drv->engine_list);
 
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-27  6:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-24  5:51 [PATCH] drm/sun4i: mixer: Check clock enable failures Pengpeng Hou
2026-06-27  6:36 ` Jernej Škrabec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox