* [PATCH -next] clk: keystone: fix return value check in _of_pll_clk_init()
@ 2013-10-31 10:36 Wei Yongjun
0 siblings, 0 replies; only message in thread
From: Wei Yongjun @ 2013-10-31 10:36 UTC (permalink / raw)
To: mturquette, santosh.shilimkar; +Cc: yongjun_wei, linux-arm-kernel, linux-kernel
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
clk_register_pll() returns ERR_PTR() when memory alloc fail and NULL
in the other case, the user of this function should used IS_ERR_OR_NULL()
to check the return value. this patch change clk_register_pll() to return
only ERR_PTR(), and also fixed the user.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/clk/keystone/pll.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c
index 47a1bd9..78a6e0e 100644
--- a/drivers/clk/keystone/pll.c
+++ b/drivers/clk/keystone/pll.c
@@ -127,12 +127,9 @@ static struct clk *clk_register_pll(struct device *dev,
clk = clk_register(NULL, &pll->hw);
if (IS_ERR(clk))
- goto out;
+ kfree(pll);
return clk;
-out:
- kfree(pll);
- return NULL;
}
/**
@@ -182,7 +179,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(clk)) {
of_clk_add_provider(node, of_clk_src_simple_get, clk);
return;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-10-31 10:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-31 10:36 [PATCH -next] clk: keystone: fix return value check in _of_pll_clk_init() Wei Yongjun
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).