mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Ricardo Ribalda <ribalda@chromium.org>
To: "Sakari Ailus" <sakari.ailus@linux.intel.com>,
	"Krzysztof Hałasa" <khalasa@piap.pl>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Sylwester Nawrocki" <s.nawrocki@samsung.com>,
	"Andrzej Hajda" <andrzej.hajda@intel.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Kevin Hilman" <khilman@baylibre.com>,
	"Jerome Brunet" <jbrunet@baylibre.com>,
	"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	linux-media@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-amlogic@lists.infradead.org,
	 linux-staging@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	 Ricardo Ribalda <ribalda@chromium.org>
Subject: [PATCH v2 3/6] media: i2c: s5c73m3: Move clk_prepare to its own function
Date: Fri, 16 Aug 2024 12:32:01 +0000	[thread overview]
Message-ID: <20240816-smatch-clock-v2-3-c63105db07e8@chromium.org> (raw)
In-Reply-To: <20240816-smatch-clock-v2-0-c63105db07e8@chromium.org>

Smatch is very confused by a clk_prepare_enable() being called in an
error-path. Fix this warning by moving the clk_prepare_enable() to its
own function.

drivers/media/i2c/s5c73m3/s5c73m3-core.c:1425 __s5c73m3_power_off() warn: 'state->clock' from clk_prepare_enable() not released on lines: 1425.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/i2c/s5c73m3/s5c73m3-core.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
index e89e888f028e..7716dfe2b8c9 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
@@ -1392,6 +1392,16 @@ static int __s5c73m3_power_on(struct s5c73m3 *state)
 	return ret;
 }
 
+/*
+ * This function has been created just to avoid a smatch warning,
+ * please do not merge into __s5c73m3_power_off() until you have
+ * confirmed that it does not introduce a new warning.
+ */
+static void s5c73m3_enable_clk(struct s5c73m3 *state)
+{
+	clk_prepare_enable(state->clock);
+}
+
 static int __s5c73m3_power_off(struct s5c73m3 *state)
 {
 	int i, ret;
@@ -1421,7 +1431,8 @@ static int __s5c73m3_power_off(struct s5c73m3 *state)
 				 state->supplies[i].supply, r);
 	}
 
-	clk_prepare_enable(state->clock);
+	s5c73m3_enable_clk(state);
+
 	return ret;
 }
 

-- 
2.46.0.184.g6999bdac58-goog


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  parent reply	other threads:[~2024-08-16 12:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-16 12:31 [PATCH v2 0/6] media: Fix last smatch warnings Ricardo Ribalda
2024-08-16 12:31 ` [PATCH v2 1/6] media: ar0521: Refactor ar0521_power_off() Ricardo Ribalda
2024-09-02  7:11   ` Krzysztof Hałasa
2024-08-16 12:32 ` [PATCH v2 2/6] media: i2c: ov5645: Refactor ov5645_set_power_off() Ricardo Ribalda
2024-08-16 12:32 ` Ricardo Ribalda [this message]
2024-08-16 12:32 ` [PATCH v2 4/6] media: tc358746: Move clk_prepare to its own function Ricardo Ribalda
2024-08-16 12:32 ` [PATCH v2 5/6] media: meson: vdec_1: Refactor vdec_1_stop() Ricardo Ribalda
2024-08-16 12:32 ` [PATCH v2 6/6] media: meson: vdec: hevc: Refactor vdec_hevc_start and vdec_hevc_stop Ricardo Ribalda

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=20240816-smatch-clock-v2-3-c63105db07e8@chromium.org \
    --to=ribalda@chromium.org \
    --cc=andrzej.hajda@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jbrunet@baylibre.com \
    --cc=khalasa@piap.pl \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=mchehab@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sakari.ailus@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®