Message ID | 20161023081249.24668-1-christophe.jaillet@wanadoo.fr (mailing list archive) |
---|---|
State | Changes Requested, archived |
Headers | show |
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 -- 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
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
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 linux-clk" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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; }
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(-)