From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] clk: fix clk_get on of_clk_get_by_name return check
Date: Sun, 15 Jul 2012 10:10:59 -0500 [thread overview]
Message-ID: <5002DD83.2020808@gmail.com> (raw)
In-Reply-To: <1342361384-21299-1-git-send-email-shawn.guo@linaro.org>
On 07/15/2012 09:09 AM, Shawn Guo wrote:
> The commit 766e6a4 (clk: add DT clock binding support) plugs device
> tree clk lookup of_clk_get_by_name into clk_get, and fall on non-DT
> lookup clk_get_sys if DT lookup fails.
>
> The return check on of_clk_get_by_name takes (clk != NULL) as a
> successful DT lookup. But it's not the case. For any system that
> does not define clk lookup in device tree, ERR_PTR(-ENOENT) will be
> returned, and consequently, all the client drivers calling clk_get
> in their probe functions will fail to probe with error code -ENOENT
> returned.
>
> Fix the issue by checking of_clk_get_by_name return with !IS_ERR(clk).
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Thanks Shawn.
Acked-by: Rob Herring <rob.herring@calxeda.com>
> ---
> drivers/clk/clkdev.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> index 20649b3..69085e0 100644
> --- a/drivers/clk/clkdev.c
> +++ b/drivers/clk/clkdev.c
> @@ -157,7 +157,7 @@ struct clk *clk_get(struct device *dev, const char *con_id)
>
> if (dev) {
> clk = of_clk_get_by_name(dev->of_node, con_id);
> - if (clk && __clk_get(clk))
> + if (!IS_ERR(clk) && __clk_get(clk))
> return clk;
> }
>
>
next prev parent reply other threads:[~2012-07-15 15:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-15 14:09 [PATCH] clk: fix clk_get on of_clk_get_by_name return check Shawn Guo
2012-07-15 15:10 ` Rob Herring [this message]
2012-07-15 15:20 ` Marek Vasut
2012-07-17 8:12 ` Lauri Hintsala
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=5002DD83.2020808@gmail.com \
--to=robherring2@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).