* [PATCH] clk: fix error path inside clk_get()
@ 2012-07-15 18:01 John Crispin
[not found] ` <1342375269-6410-1-git-send-email-blogic-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: John Crispin @ 2012-07-15 18:01 UTC (permalink / raw)
To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Rob Herring
clk_get() calls of_clk_get_by_name() which can return a ERR_PTR. The error path
currently only checks for !NULL. We need to use !IS_ERR_OR_NULL instead.
This bug was introduced by 766e6a4ec602d0c107553b91b3434fe9c03474f4
Signed-off-by: John Crispin <blogic-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
Cc: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
---
I am seeing this bug on linux-next from 13.07.2012
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..7100d5c 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_OR_NULL(clk) && __clk_get(clk))
return clk;
}
--
1.7.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] clk: fix error path inside clk_get()
[not found] ` <1342375269-6410-1-git-send-email-blogic-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
@ 2012-07-15 19:03 ` Rob Herring
0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2012-07-15 19:03 UTC (permalink / raw)
To: John Crispin; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Mike Turquette
On 07/15/2012 01:01 PM, John Crispin wrote:
> clk_get() calls of_clk_get_by_name() which can return a ERR_PTR. The error path
> currently only checks for !NULL. We need to use !IS_ERR_OR_NULL instead.
>
> This bug was introduced by 766e6a4ec602d0c107553b91b3434fe9c03474f4
>
> Signed-off-by: John Crispin <blogic-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
> Cc: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
> Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> ---
> I am seeing this bug on linux-next from 13.07.2012
Already got a fix for this from Shawn Guo earlier today.
>
> 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..7100d5c 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_OR_NULL(clk) && __clk_get(clk))
IS_ERR() is correct here.
Rob
> return clk;
> }
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-07-15 19:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-15 18:01 [PATCH] clk: fix error path inside clk_get() John Crispin
[not found] ` <1342375269-6410-1-git-send-email-blogic-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2012-07-15 19:03 ` Rob Herring
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).