From: Flavio Ceolin Date: Wed, 6 Dec 2017 16:37:45 +0000 (-0500) Subject: media: s5p-jpeg: Fix off-by-one problem X-Git-Tag: v4.19~1636^2~150 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b6852a6dda2cfc16faf48ca075c120d2a3ba6b04;p=platform%2Fkernel%2Flinux-rpi.git media: s5p-jpeg: Fix off-by-one problem s5p_jpeg_runtime_resume() does not call clk_disable_unprepare() for jpeg->clocks[0] when one of the clk_prepare_enable() fails. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Flavio Ceolin Acked-by: Andrzej Pietrasiewicz Signed-off-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index faac816..79b63da 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -3086,7 +3086,7 @@ static int s5p_jpeg_runtime_resume(struct device *dev) for (i = 0; i < jpeg->variant->num_clocks; i++) { ret = clk_prepare_enable(jpeg->clocks[i]); if (ret) { - while (--i > 0) + while (--i >= 0) clk_disable_unprepare(jpeg->clocks[i]); return ret; }