All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: keystone: Fix an error checking
@ 2016-10-23  8:12 ` Christophe JAILLET
  0 siblings, 0 replies; 8+ messages in thread
From: Christophe JAILLET @ 2016-10-23  8:12 UTC (permalink / raw)
  To: ssantosh, mturquette, sboyd
  Cc: linux-clk, linux-kernel, kernel-janitors, Christophe JAILLET

clk_register_pll() can return ERR_PTR(-ENOMEM) so here the check against
NULL only is not correct.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Un-compiled and un-tested.
---
 drivers/clk/keystone/pll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c
index a26ba2184454..b936029fa211 100644
--- a/drivers/clk/keystone/pll.c
+++ b/drivers/clk/keystone/pll.c
@@ -213,7 +213,7 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl)
 	}
 
 	clk = clk_register_pll(NULL, node->name, parent_name, pll_data);
-	if (clk) {
+	if (!IS_ERR_OR_NULL(clk)) {
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
 		return;
 	}
-- 
2.9.3


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

* [PATCH] clk: keystone: Fix an error checking
@ 2016-10-23  8:12 ` Christophe JAILLET
  0 siblings, 0 replies; 8+ messages in thread
From: Christophe JAILLET @ 2016-10-23  8:12 UTC (permalink / raw)
  To: ssantosh, mturquette, sboyd
  Cc: linux-clk, linux-kernel, kernel-janitors, Christophe JAILLET

clk_register_pll() can return ERR_PTR(-ENOMEM) so here the check against
NULL only is not correct.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Un-compiled and un-tested.
---
 drivers/clk/keystone/pll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c
index a26ba2184454..b936029fa211 100644
--- a/drivers/clk/keystone/pll.c
+++ b/drivers/clk/keystone/pll.c
@@ -213,7 +213,7 @@ static void __init _of_pll_clk_init(struct device_node *node, bool pllctrl)
 	}
 
 	clk = clk_register_pll(NULL, node->name, parent_name, pll_data);
-	if (clk) {
+	if (!IS_ERR_OR_NULL(clk)) {
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
 		return;
 	}
-- 
2.9.3

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

* Re: [PATCH] clk: keystone: Fix an error checking
  2016-10-23  8:12 ` Christophe JAILLET
@ 2016-10-24 10:36   ` Dan Carpenter
  -1 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2016-10-24 10:36 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: ssantosh, mturquette, sboyd, linux-clk, linux-kernel,
	kernel-janitors

On Sun, Oct 23, 2016 at 10:12:49AM +0200, Christophe JAILLET wrote:
> clk_register_pll() can return ERR_PTR(-ENOMEM) so here the check against
> NULL only is not correct.
> 

Change the ERR_PTR(-ENOMEM) to a NULL instead.  When we mix error
pointers and NULL, what it means is that NULL should be treated as a
success case.  That's not the case here, so we should just return NULL
since we don't actually care about the error codes.

regards,
dan carpenter


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

* Re: [PATCH] clk: keystone: Fix an error checking
@ 2016-10-24 10:36   ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2016-10-24 10:36 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: ssantosh, mturquette, sboyd, linux-clk, linux-kernel,
	kernel-janitors

On Sun, Oct 23, 2016 at 10:12:49AM +0200, Christophe JAILLET wrote:
> clk_register_pll() can return ERR_PTR(-ENOMEM) so here the check against
> NULL only is not correct.
> 

Change the ERR_PTR(-ENOMEM) to a NULL instead.  When we mix error
pointers and NULL, what it means is that NULL should be treated as a
success case.  That's not the case here, so we should just return NULL
since we don't actually care about the error codes.

regards,
dan carpenter

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

* Re: [PATCH] clk: keystone: Fix an error checking
  2016-10-24 10:36   ` Dan Carpenter
@ 2016-10-24 10:41     ` Lars-Peter Clausen
  -1 siblings, 0 replies; 8+ messages in thread
From: Lars-Peter Clausen @ 2016-10-24 10:41 UTC (permalink / raw)
  To: Dan Carpenter, Christophe JAILLET
  Cc: ssantosh, mturquette, sboyd, linux-clk, linux-kernel,
	kernel-janitors

On 10/24/2016 12:36 PM, Dan Carpenter wrote:
> On Sun, Oct 23, 2016 at 10:12:49AM +0200, Christophe JAILLET wrote:
>> clk_register_pll() can return ERR_PTR(-ENOMEM) so here the check against
>> NULL only is not correct.
>>
> 
> Change the ERR_PTR(-ENOMEM) to a NULL instead.

In this particular case propagate the error returned by clk_register().


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

* Re: [PATCH] clk: keystone: Fix an error checking
@ 2016-10-24 10:41     ` Lars-Peter Clausen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars-Peter Clausen @ 2016-10-24 10:41 UTC (permalink / raw)
  To: Dan Carpenter, Christophe JAILLET
  Cc: ssantosh, mturquette, sboyd, linux-clk, linux-kernel,
	kernel-janitors

On 10/24/2016 12:36 PM, Dan Carpenter wrote:
> On Sun, Oct 23, 2016 at 10:12:49AM +0200, Christophe JAILLET wrote:
>> clk_register_pll() can return ERR_PTR(-ENOMEM) so here the check against
>> NULL only is not correct.
>>
> 
> Change the ERR_PTR(-ENOMEM) to a NULL instead.

In this particular case propagate the error returned by clk_register().

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

* Re: [PATCH] clk: keystone: Fix an error checking
  2016-10-24 10:41     ` Lars-Peter Clausen
@ 2016-10-24 20:14       ` Christophe JAILLET
  -1 siblings, 0 replies; 8+ messages in thread
From: Christophe JAILLET @ 2016-10-24 20:14 UTC (permalink / raw)
  To: Lars-Peter Clausen, Dan Carpenter
  Cc: ssantosh, mturquette, sboyd, linux-clk, linux-kernel,
	kernel-janitors

Hi,

Thanks for the review and comments.

I'll send another patch for that.
It will not be tagged as v2 because it will be part of a patch set for 
some other potential fixes.

CJ

Le 24/10/2016 à 12:41, Lars-Peter Clausen a écrit :
> On 10/24/2016 12:36 PM, Dan Carpenter wrote:
>> On Sun, Oct 23, 2016 at 10:12:49AM +0200, Christophe JAILLET wrote:
>>> clk_register_pll() can return ERR_PTR(-ENOMEM) so here the check against
>>> NULL only is not correct.
>>>
>> Change the ERR_PTR(-ENOMEM) to a NULL instead.
> In this particular case propagate the error returned by clk_register().
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-clk" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] clk: keystone: Fix an error checking
@ 2016-10-24 20:14       ` Christophe JAILLET
  0 siblings, 0 replies; 8+ messages in thread
From: Christophe JAILLET @ 2016-10-24 20:14 UTC (permalink / raw)
  To: Lars-Peter Clausen, Dan Carpenter
  Cc: ssantosh, mturquette, sboyd, linux-clk, linux-kernel,
	kernel-janitors

Hi,

Thanks for the review and comments.

I'll send another patch for that.
It will not be tagged as v2 because it will be part of a patch set for 
some other potential fixes.

CJ

Le 24/10/2016 à 12:41, Lars-Peter Clausen a écrit :
> On 10/24/2016 12:36 PM, Dan Carpenter wrote:
>> On Sun, Oct 23, 2016 at 10:12:49AM +0200, Christophe JAILLET wrote:
>>> clk_register_pll() can return ERR_PTR(-ENOMEM) so here the check against
>>> NULL only is not correct.
>>>
>> Change the ERR_PTR(-ENOMEM) to a NULL instead.
> In this particular case propagate the error returned by clk_register().
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-clk" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

end of thread, other threads:[~2016-10-24 20:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-23  8:12 [PATCH] clk: keystone: Fix an error checking Christophe JAILLET
2016-10-23  8:12 ` Christophe JAILLET
2016-10-24 10:36 ` Dan Carpenter
2016-10-24 10:36   ` Dan Carpenter
2016-10-24 10:41   ` Lars-Peter Clausen
2016-10-24 10:41     ` Lars-Peter Clausen
2016-10-24 20:14     ` Christophe JAILLET
2016-10-24 20:14       ` Christophe JAILLET

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.