summaryrefslogtreecommitdiff
path: root/drivers/media/platform/s5p-jpeg
diff options
context:
space:
mode:
authorFlavio Ceolin <flavio.ceolin@intel.com>2017-12-06 19:37:45 +0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-18 23:12:30 +0300
commitb6852a6dda2cfc16faf48ca075c120d2a3ba6b04 (patch)
tree0152b48dbbc49399800bb1185681fbd8a3baf449 /drivers/media/platform/s5p-jpeg
parent3090a1915e9865d23f2aa76cc01e5b5f9cb6d7e3 (diff)
downloadlinux-b6852a6dda2cfc16faf48ca075c120d2a3ba6b04.tar.xz
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 <flavio.ceolin@intel.com> Acked-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/platform/s5p-jpeg')
-rw-r--r--drivers/media/platform/s5p-jpeg/jpeg-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index faac8161b683..79b63da27f53 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;
}