Message ID | 20241121210543.8190-1-jiashengjiangcool@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | [1/2] media: mipi-csis: Add check for clk_enable() | expand |
On 21/11/2024 22:05, Jiasheng Jiang wrote: > Add check for the return value of clk_enable() to gurantee the success. > > Fixes: b5f1220d587d ("[media] v4l: Add v4l2 subdev driver for S5P/EXYNOS4 MIPI-CSI receivers") > Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com> > --- > drivers/media/platform/samsung/exynos4-is/mipi-csis.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/samsung/exynos4-is/mipi-csis.c b/drivers/media/platform/samsung/exynos4-is/mipi-csis.c > index 63f3eecdd7e6..d1c938065475 100644 > --- a/drivers/media/platform/samsung/exynos4-is/mipi-csis.c > +++ b/drivers/media/platform/samsung/exynos4-is/mipi-csis.c > @@ -940,7 +940,9 @@ static int s5pcsis_pm_resume(struct device *dev, bool runtime) > state->supplies); > goto unlock; > } > - clk_enable(state->clock[CSIS_CLK_GATE]); > + ret = clk_enable(state->clock[CSIS_CLK_GATE]); > + if (ret) > + goto unlock; You should unwind the work done, so power off the phy and disble regulators. Best regards, Krzysztof
Hi Krzysztof, On Fri, Nov 22, 2024 at 2:01 AM Krzysztof Kozlowski <krzk@kernel.org> wrote: > > On 21/11/2024 22:05, Jiasheng Jiang wrote: > > Add check for the return value of clk_enable() to gurantee the success. > > > > Fixes: b5f1220d587d ("[media] v4l: Add v4l2 subdev driver for S5P/EXYNOS4 MIPI-CSI receivers") > > Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com> > > --- > > drivers/media/platform/samsung/exynos4-is/mipi-csis.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/media/platform/samsung/exynos4-is/mipi-csis.c b/drivers/media/platform/samsung/exynos4-is/mipi-csis.c > > index 63f3eecdd7e6..d1c938065475 100644 > > --- a/drivers/media/platform/samsung/exynos4-is/mipi-csis.c > > +++ b/drivers/media/platform/samsung/exynos4-is/mipi-csis.c > > @@ -940,7 +940,9 @@ static int s5pcsis_pm_resume(struct device *dev, bool runtime) > > state->supplies); > > goto unlock; > > } > > - clk_enable(state->clock[CSIS_CLK_GATE]); > > + ret = clk_enable(state->clock[CSIS_CLK_GATE]); > > + if (ret) > > + goto unlock; > > You should unwind the work done, so power off the phy and disble regulators. Thank you for your advice. I will submit a v2 patch. Additionally, I noticed a redundant space before the label "unlock," so I will remove it as well. -Jiasheng
diff --git a/drivers/media/platform/samsung/s3c-camif/camif-core.c b/drivers/media/platform/samsung/s3c-camif/camif-core.c index de6e8f151849..221e3c447f36 100644 --- a/drivers/media/platform/samsung/s3c-camif/camif-core.c +++ b/drivers/media/platform/samsung/s3c-camif/camif-core.c @@ -527,10 +527,19 @@ static void s3c_camif_remove(struct platform_device *pdev) static int s3c_camif_runtime_resume(struct device *dev) { struct camif_dev *camif = dev_get_drvdata(dev); + int ret; + + ret = clk_enable(camif->clock[CLK_GATE]); + if (ret) + return ret; - clk_enable(camif->clock[CLK_GATE]); /* null op on s3c244x */ - clk_enable(camif->clock[CLK_CAM]); + ret = clk_enable(camif->clock[CLK_CAM]); + if (ret) { + clk_disable(camif->clock[CLK_GATE]); + return ret; + } + return 0; }
Add check for the return value of clk_enable() to gurantee the success. Fixes: babde1c243b2 ("[media] V4L: Add driver for S3C24XX/S3C64XX SoC series camera interface") Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com> --- .../media/platform/samsung/s3c-camif/camif-core.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)