Linux-Samsung-soc Archive mirror
 help / color / mirror / Atom feed
From: Zhaoyang Yu <2426767509@qq.com>
To: s.nawrocki@samsung.com, mchehab@kernel.org, krzk@kernel.org
Cc: alim.akhtar@samsung.com, linux-media@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zhaoyang Yu <2426767509@qq.com>
Subject: [PATCH] media: fimc: check return value of clk_enable in runtime_resume" -m "In fimc_runtime_resume(), the return value of clk_enable(fimc->clock[CLK_GATE]) was not checked. If enabling the clock fails, subsequent register accesses (fimc_hw_reset() and capture/m2m resume) may trigger a bus error or undefined behavior.
Date: Sun,  1 Mar 2026 16:18:54 +0000	[thread overview]
Message-ID: <tencent_416C0B949035FA7EF2B7F614AFEFC0D64807@qq.com> (raw)

Fix this by checking the return value. If clk_enable() fails, return the
error immediately, preventing unsafe hardware access.

Signed-off-by: Zhaoyang Yu <2426767509@qq.com>
---
 drivers/media/platform/samsung/exynos4-is/fimc-core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-core.c b/drivers/media/platform/samsung/exynos4-is/fimc-core.c
index 2c9edd0a559b..57e573949e54 100644
--- a/drivers/media/platform/samsung/exynos4-is/fimc-core.c
+++ b/drivers/media/platform/samsung/exynos4-is/fimc-core.c
@@ -1020,11 +1020,15 @@ static int fimc_probe(struct platform_device *pdev)
 static int fimc_runtime_resume(struct device *dev)
 {
 	struct fimc_dev *fimc =	dev_get_drvdata(dev);
+	int ret;
 
 	dbg("fimc%d: state: 0x%lx", fimc->id, fimc->state);
 
 	/* Enable clocks and perform basic initialization */
-	clk_enable(fimc->clock[CLK_GATE]);
+	ret = clk_enable(fimc->clock[CLK_GATE]);
+	if (ret)
+		return ret;
+
 	fimc_hw_reset(fimc);
 
 	/* Resume the capture or mem-to-mem device */
-- 
2.34.1


                 reply	other threads:[~2026-03-01 16:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=tencent_416C0B949035FA7EF2B7F614AFEFC0D64807@qq.com \
    --to=2426767509@qq.com \
    --cc=alim.akhtar@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=s.nawrocki@samsung.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).