diff mbox series

drm/exynos: gsc: minor fix for loop iteration in gsc_runtime_resume

Message ID 20231220095316.23098-1-pchelkin@ispras.ru (mailing list archive)
State New, archived
Headers show
Series drm/exynos: gsc: minor fix for loop iteration in gsc_runtime_resume | expand

Commit Message

Fedor Pchelkin Dec. 20, 2023, 9:53 a.m. UTC
Do not forget to call clk_disable_unprepare() on the first element of
ctx->clocks array.

Found by Linux Verification Center (linuxtesting.org).

Fixes: 8b7d3ec83aba ("drm/exynos: gsc: Convert driver to IPP v2 core API")
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
---
 drivers/gpu/drm/exynos/exynos_drm_gsc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marek Szyprowski Dec. 20, 2023, 10:39 a.m. UTC | #1
On 20.12.2023 10:53, Fedor Pchelkin wrote:
> Do not forget to call clk_disable_unprepare() on the first element of
> ctx->clocks array.
>
> Found by Linux Verification Center (linuxtesting.org).
>
> Fixes: 8b7d3ec83aba ("drm/exynos: gsc: Convert driver to IPP v2 core API")
> Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>   drivers/gpu/drm/exynos/exynos_drm_gsc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> index 34cdabc30b4f..5302bebbe38c 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> @@ -1342,7 +1342,7 @@ static int __maybe_unused gsc_runtime_resume(struct device *dev)
>   	for (i = 0; i < ctx->num_clocks; i++) {
>   		ret = clk_prepare_enable(ctx->clocks[i]);
>   		if (ret) {
> -			while (--i > 0)
> +			while (--i >= 0)
>   				clk_disable_unprepare(ctx->clocks[i]);
>   			return ret;
>   		}

Best regards
Inki Dae Dec. 21, 2023, 4:27 a.m. UTC | #2
2023년 12월 20일 (수) 오후 7:45, Marek Szyprowski <m.szyprowski@samsung.com>님이 작성:

> On 20.12.2023 10:53, Fedor Pchelkin wrote:
> > Do not forget to call clk_disable_unprepare() on the first element of
> > ctx->clocks array.
> >
> > Found by Linux Verification Center (linuxtesting.org).
> >
> > Fixes: 8b7d3ec83aba ("drm/exynos: gsc: Convert driver to IPP v2 core
> API")
> > Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
> Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
>

Applied.

Thanks,
Inki Dae

> ---
> >   drivers/gpu/drm/exynos/exynos_drm_gsc.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> > index 34cdabc30b4f..5302bebbe38c 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> > @@ -1342,7 +1342,7 @@ static int __maybe_unused
> gsc_runtime_resume(struct device *dev)
> >       for (i = 0; i < ctx->num_clocks; i++) {
> >               ret = clk_prepare_enable(ctx->clocks[i]);
> >               if (ret) {
> > -                     while (--i > 0)
> > +                     while (--i >= 0)
> >                               clk_disable_unprepare(ctx->clocks[i]);
> >                       return ret;
> >               }
>
> Best regards
> --
> Marek Szyprowski, PhD
> Samsung R&D Institute Poland
>
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
index 34cdabc30b4f..5302bebbe38c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
@@ -1342,7 +1342,7 @@  static int __maybe_unused gsc_runtime_resume(struct device *dev)
 	for (i = 0; i < ctx->num_clocks; i++) {
 		ret = clk_prepare_enable(ctx->clocks[i]);
 		if (ret) {
-			while (--i > 0)
+			while (--i >= 0)
 				clk_disable_unprepare(ctx->clocks[i]);
 			return ret;
 		}