Message ID | 1342791397-11732-1-git-send-email-pdeschrijver@nvidia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Jul 20, 2012 at 03:36:37PM +0200, Peter De Schrijver wrote: > of_clk_get_by_name returns an ERR_PTR on failure. Hence we should use IS_ERR() > and not just check for a non NULL value. > > Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.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 8f87b0f..d423c9b 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; > } http://www.spinics.net/lists/arm-kernel/msg184794.html introduces this behaviour of of_clk_get_by_name() Cheers, Peter.
On Fri, Jul 20, 2012 at 03:36:37PM +0200, Peter De Schrijver wrote: > of_clk_get_by_name returns an ERR_PTR on failure. Hence we should use IS_ERR() > and not just check for a non NULL value. > > Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.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 8f87b0f..d423c9b 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; > } http://www.spinics.net/lists/arm-kernel/msg184794.html introduces this behaviour of of_clk_get_by_name() Cheers, Peter.
diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 8f87b0f..d423c9b 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; }
of_clk_get_by_name returns an ERR_PTR on failure. Hence we should use IS_ERR() and not just check for a non NULL value. Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com> --- drivers/clk/clkdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)