linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: at91: fix check of clk_register() returned value
@ 2016-03-07 23:41 Vladimir Zapolskiy
  2016-03-08  3:06 ` Alexandre Belloni
  2016-04-15 23:57 ` Stephen Boyd
  0 siblings, 2 replies; 4+ messages in thread
From: Vladimir Zapolskiy @ 2016-03-07 23:41 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Boris Brezillon,
	Alexandre Belloni
  Cc: linux-clk

The clk_register() function returns a valid pointer to struct clk or
ERR_PTR() error code, this makes a check for returned NULL value
useless and may lead to oops on error path.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
---
Alexandre, Boris,

I've seen your recent huge updates to the driver, but I haven't found
them in clk-next, I hope that this trivial fix against clk-next won't
cause a big pain on rebase.

 drivers/clk/at91/clk-h32mx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/at91/clk-h32mx.c b/drivers/clk/at91/clk-h32mx.c
index 61566bc..a165230 100644
--- a/drivers/clk/at91/clk-h32mx.c
+++ b/drivers/clk/at91/clk-h32mx.c
@@ -116,7 +116,7 @@ void __init of_sama5d4_clk_h32mx_setup(struct device_node *np,
 	h32mxclk->pmc = pmc;
 
 	clk = clk_register(NULL, &h32mxclk->hw);
-	if (!clk) {
+	if (IS_ERR(clk)) {
 		kfree(h32mxclk);
 		return;
 	}
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] clk: at91: fix check of clk_register() returned value
  2016-03-07 23:41 [PATCH] clk: at91: fix check of clk_register() returned value Vladimir Zapolskiy
@ 2016-03-08  3:06 ` Alexandre Belloni
  2016-03-08 11:33   ` Boris Brezillon
  2016-04-15 23:57 ` Stephen Boyd
  1 sibling, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2016-03-08  3:06 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Michael Turquette, Stephen Boyd, Boris Brezillon, linux-clk

On 08/03/2016 at 01:41:29 +0200, Vladimir Zapolskiy wrote :
> The clk_register() function returns a valid pointer to struct clk or
> ERR_PTR() error code, this makes a check for returned NULL value
> useless and may lead to oops on error path.
> 
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
> Alexandre, Boris,
> 
> I've seen your recent huge updates to the driver, but I haven't found
> them in clk-next, I hope that this trivial fix against clk-next won't
> cause a big pain on rebase.
> 

They went through arm-soc and should have been in linux-next for a while
now.

>  drivers/clk/at91/clk-h32mx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/at91/clk-h32mx.c b/drivers/clk/at91/clk-h32mx.c
> index 61566bc..a165230 100644
> --- a/drivers/clk/at91/clk-h32mx.c
> +++ b/drivers/clk/at91/clk-h32mx.c
> @@ -116,7 +116,7 @@ void __init of_sama5d4_clk_h32mx_setup(struct device_node *np,
>  	h32mxclk->pmc = pmc;
>  
>  	clk = clk_register(NULL, &h32mxclk->hw);
> -	if (!clk) {
> +	if (IS_ERR(clk)) {
>  		kfree(h32mxclk);
>  		return;
>  	}
> -- 
> 2.1.4
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] clk: at91: fix check of clk_register() returned value
  2016-03-08  3:06 ` Alexandre Belloni
@ 2016-03-08 11:33   ` Boris Brezillon
  0 siblings, 0 replies; 4+ messages in thread
From: Boris Brezillon @ 2016-03-08 11:33 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Vladimir Zapolskiy, Michael Turquette, Stephen Boyd, linux-clk

On Tue, 8 Mar 2016 04:06:00 +0100
Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:

> On 08/03/2016 at 01:41:29 +0200, Vladimir Zapolskiy wrote :
> > The clk_register() function returns a valid pointer to struct clk or
> > ERR_PTR() error code, this makes a check for returned NULL value
> > useless and may lead to oops on error path.
> > 
> > Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> 
> > ---
> > Alexandre, Boris,
> > 
> > I've seen your recent huge updates to the driver, but I haven't found
> > them in clk-next, I hope that this trivial fix against clk-next won't
> > cause a big pain on rebase.
> > 
> 
> They went through arm-soc and should have been in linux-next for a while
> now.
> 
> >  drivers/clk/at91/clk-h32mx.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/clk/at91/clk-h32mx.c b/drivers/clk/at91/clk-h32mx.c
> > index 61566bc..a165230 100644
> > --- a/drivers/clk/at91/clk-h32mx.c
> > +++ b/drivers/clk/at91/clk-h32mx.c
> > @@ -116,7 +116,7 @@ void __init of_sama5d4_clk_h32mx_setup(struct device_node *np,
> >  	h32mxclk->pmc = pmc;
> >  
> >  	clk = clk_register(NULL, &h32mxclk->hw);
> > -	if (!clk) {
> > +	if (IS_ERR(clk)) {
> >  		kfree(h32mxclk);
> >  		return;
> >  	}
> > -- 
> > 2.1.4
> > 
> 



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] clk: at91: fix check of clk_register() returned value
  2016-03-07 23:41 [PATCH] clk: at91: fix check of clk_register() returned value Vladimir Zapolskiy
  2016-03-08  3:06 ` Alexandre Belloni
@ 2016-04-15 23:57 ` Stephen Boyd
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2016-04-15 23:57 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Michael Turquette, Boris Brezillon, Alexandre Belloni, linux-clk

On 03/08, Vladimir Zapolskiy wrote:
> The clk_register() function returns a valid pointer to struct clk or
> ERR_PTR() error code, this makes a check for returned NULL value
> useless and may lead to oops on error path.
> 
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
> ---

Applied to clk-next + added Fixes tag.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-15 23:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-07 23:41 [PATCH] clk: at91: fix check of clk_register() returned value Vladimir Zapolskiy
2016-03-08  3:06 ` Alexandre Belloni
2016-03-08 11:33   ` Boris Brezillon
2016-04-15 23:57 ` Stephen Boyd

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).