On Sun Mar 1 16:18:54 2026 +0000, Zhaoyang Yu wrote:
> 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.
>
> Fix this by checking the return value. If clk_enable() fails, return the
> error immediately, preventing unsafe hardware access.
>
> Signed-off-by: Zhaoyang Yu <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>
Patch committed.
Thanks,
Hans Verkuil
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 @@ err_sclk:
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 */
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]