[PATCH] clk: fix error path inside clk_get()

John Crispin blogic at openwrt.org
Mon Jul 16 04:01:09 EST 2012


clk_get() calls of_clk_get_by_name() which can return a ERR_PTR. The error path
currently only checks for !NULL. We need to use !IS_ERR_OR_NULL instead.

This bug was introduced by 766e6a4ec602d0c107553b91b3434fe9c03474f4

Signed-off-by: John Crispin <blogic at openwrt.org>
Cc: Rob Herring <rob.herring at calxeda.com>
Cc: Grant Likely <grant.likely at secretlab.ca>
Cc: devicetree-discuss at lists.ozlabs.org
---
I am seeing this bug on linux-next from 13.07.2012

 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 20649b3..7100d5c 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_OR_NULL(clk) && __clk_get(clk))
 			return clk;
 	}
 
-- 
1.7.9.1



More information about the devicetree-discuss mailing list