All of lore.kernel.org
 help / color / mirror / Atom feed
From: Flavio Ceolin <flavio.ceolin@intel.com>
To: linux-kernel@vger.kernel.org
Cc: Flavio Ceolin <flavio.ceolin@intel.com>,
	Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-arm-kernel@lists.infradead.org (open list:ARM/SAMSUNG S5P
	SERIES JPEG CODEC SUPPORT),
	linux-media@vger.kernel.org (open list:ARM/SAMSUNG S5P SERIES
	JPEG CODEC SUPPORT)
Subject: [PATCH] media: s5p-jpeg: Fix off-by-one problem
Date: Wed,  6 Dec 2017 08:37:45 -0800	[thread overview]
Message-ID: <20171206163746.8456-1-flavio.ceolin@intel.com> (raw)

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>
---
 drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 		}
-- 
2.9.5

WARNING: multiple messages have this Message-ID (diff)
From: flavio.ceolin@intel.com (Flavio Ceolin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] media: s5p-jpeg: Fix off-by-one problem
Date: Wed,  6 Dec 2017 08:37:45 -0800	[thread overview]
Message-ID: <20171206163746.8456-1-flavio.ceolin@intel.com> (raw)

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>
---
 drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 		}
-- 
2.9.5

             reply	other threads:[~2017-12-06 16:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20171206163802epcas1p3527bd6a922fd31aa80cf349a510a71eb@epcas1p3.samsung.com>
2017-12-06 16:37 ` Flavio Ceolin [this message]
2017-12-06 16:37   ` [PATCH] media: s5p-jpeg: Fix off-by-one problem Flavio Ceolin
2017-12-07 14:53   ` Andrzej Pietrasiewicz
2017-12-07 14:53     ` Andrzej Pietrasiewicz
2017-12-07 14:53     ` Andrzej Pietrasiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171206163746.8456-1-flavio.ceolin@intel.com \
    --to=flavio.ceolin@intel.com \
    --cc=andrzej.p@samsung.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.