diff mbox series

[v2] media: marvell: Add check for clk_enable()

Message ID 20241203212902.38116-1-jiashengjiangcool@gmail.com (mailing list archive)
State New
Headers show
Series [v2] media: marvell: Add check for clk_enable() | expand

Commit Message

Jiasheng Jiang Dec. 3, 2024, 9:29 p.m. UTC
Add check for the return value of clk_enable() to gurantee the success.

Fixes: 81a409bfd551 ("media: marvell-ccic: provide a clock for the sensor")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
---
Changelog:

v1 -> v2:

1. Add pm_runtime_put().
---
 drivers/media/platform/marvell/mcam-core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Markus Elfring Dec. 4, 2024, 4 p.m. UTC | #1
> Add check for the return value of clk_enable() to gurantee the success.

                                                    guarantee?

Would you like to detect a failed function call?

Regards,
Markus
Sakari Ailus Dec. 5, 2024, 8:52 a.m. UTC | #2
On Tue, Dec 03, 2024 at 09:29:02PM +0000, Jiasheng Jiang wrote:
> Add check for the return value of clk_enable() to gurantee the success.
> 
> Fixes: 81a409bfd551 ("media: marvell-ccic: provide a clock for the sensor")
> Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>

Thanks!

Applied, with spelling of "guarantee" addressed.
diff mbox series

Patch

diff --git a/drivers/media/platform/marvell/mcam-core.c b/drivers/media/platform/marvell/mcam-core.c
index 9ec01228f907..b8360d37000a 100644
--- a/drivers/media/platform/marvell/mcam-core.c
+++ b/drivers/media/platform/marvell/mcam-core.c
@@ -935,7 +935,12 @@  static int mclk_enable(struct clk_hw *hw)
 	ret = pm_runtime_resume_and_get(cam->dev);
 	if (ret < 0)
 		return ret;
-	clk_enable(cam->clk[0]);
+	ret = clk_enable(cam->clk[0]);
+	if (ret) {
+		pm_runtime_put(cam->dev);
+		return ret;
+	}
+
 	mcam_reg_write(cam, REG_CLKCTRL, (mclk_src << 29) | mclk_div);
 	mcam_ctlr_power_up(cam);