From: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
To: Sachin Kamat <sachin.kamat@linaro.org>
Cc: linux-media@vger.kernel.org, s.nawrocki@samsung.com, patches@linaro.org
Subject: Re: [PATCH 1/6] [media] s5p-fimc: Use devm_clk_get in mipi-csis.c
Date: Sun, 25 Nov 2012 16:32:25 +0100 [thread overview]
Message-ID: <50B23A09.4010105@gmail.com> (raw)
In-Reply-To: <1353671443-2978-2-git-send-email-sachin.kamat@linaro.org>
Hi Sachin,
On 11/23/2012 12:50 PM, Sachin Kamat wrote:
> devm_clk_get is device managed and makes error handling and cleanup
> a bit simpler.
Can we postpone this once devm_clk_prepare() is available ?
> Signed-off-by: Sachin Kamat<sachin.kamat@linaro.org>
> ---
> drivers/media/platform/s5p-fimc/mipi-csis.c | 6 +-----
> 1 files changed, 1 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/platform/s5p-fimc/mipi-csis.c b/drivers/media/platform/s5p-fimc/mipi-csis.c
> index 4c961b1..d624bfa 100644
> --- a/drivers/media/platform/s5p-fimc/mipi-csis.c
> +++ b/drivers/media/platform/s5p-fimc/mipi-csis.c
> @@ -341,8 +341,6 @@ static void s5pcsis_clk_put(struct csis_state *state)
> if (IS_ERR_OR_NULL(state->clock[i]))
> continue;
> clk_unprepare(state->clock[i]);
> - clk_put(state->clock[i]);
> - state->clock[i] = NULL;
This line shouldn't be removed, it protects from releasing already
released clock resource. In fact state->clock[i] = ERR_PTR(-EINVAL);
would be more correct, but that's a different story.
> }
> }
>
> @@ -352,13 +350,11 @@ static int s5pcsis_clk_get(struct csis_state *state)
> int i, ret;
>
> for (i = 0; i< NUM_CSIS_CLOCKS; i++) {
> - state->clock[i] = clk_get(dev, csi_clock_name[i]);
> + state->clock[i] = devm_clk_get(dev, csi_clock_name[i]);
> if (IS_ERR(state->clock[i]))
> goto err;
> ret = clk_prepare(state->clock[i]);
> if (ret< 0) {
> - clk_put(state->clock[i]);
> - state->clock[i] = NULL;
And same here, now we have a pointer to valid, unprepared clock in
state->clock[i]. When s5pcsis_clk_put() gets called afterwards it will
invoke unbalanced clk_unprepare() in this clock.
I would prefer to hold on with that sort of changes in s5p-fimc driver,
until after devm_clk_prepare() is available.
> goto err;
> }
> }
Regards,
Sylwester
next prev parent reply other threads:[~2012-11-25 15:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-23 11:50 [PATCH 0/6][media] s5p-*: Use devm_clk_get APIs Sachin Kamat
2012-11-23 11:50 ` [PATCH 1/6] [media] s5p-fimc: Use devm_clk_get in mipi-csis.c Sachin Kamat
2012-11-25 15:32 ` Sylwester Nawrocki [this message]
2012-11-26 4:54 ` Sachin Kamat
2012-11-23 11:50 ` [PATCH 2/6] [media] s5p-fimc: Use devm_clk_get in fimc-core.c Sachin Kamat
2012-11-23 11:50 ` [PATCH 3/6] [media] s5p-fimc: Use devm_clk_get in fimc-lite.c Sachin Kamat
2012-11-23 11:50 ` [PATCH 4/6] [media] s5p-g2d: Use devm_clk_get APIs Sachin Kamat
2012-11-28 10:13 ` Kamil Debski
2012-11-23 11:50 ` [PATCH 5/6] [media] s5p-jpeg: " Sachin Kamat
2012-11-23 11:50 ` [PATCH 6/6] [media] s5p-mfc: " Sachin Kamat
2012-11-28 10:13 ` Kamil Debski
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=50B23A09.4010105@gmail.com \
--to=sylvester.nawrocki@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=patches@linaro.org \
--cc=s.nawrocki@samsung.com \
--cc=sachin.kamat@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox