diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2012-07-18 11:52:22 +0800 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2012-07-19 14:07:45 -0700 |
commit | 9f1612d351a8e57d3d694e828641d3e4eeb224f8 (patch) | |
tree | 454f1194686043575369eb66fa02075036f17b59 /drivers/clk/clkdev.c | |
parent | c782c384d289a382baf4a1ab544f6f4b9e72405b (diff) | |
download | lwn-9f1612d351a8e57d3d694e828641d3e4eeb224f8.tar.gz lwn-9f1612d351a8e57d3d694e828641d3e4eeb224f8.zip |
clk: fix clk_get on of_clk_get_by_name return check
The commit 766e6a4 (clk: add DT clock binding support) plugs device
tree clk lookup of_clk_get_by_name into clk_get, and fall on non-DT
lookup clk_get_sys if DT lookup fails.
The return check on of_clk_get_by_name takes (clk != NULL) as a
successful DT lookup. But it's not the case. For any system that
does not define clk lookup in device tree, ERR_PTR(-ENOENT) will be
returned, and consequently, all the client drivers calling clk_get
in their probe functions will fail to probe with error code -ENOENT
returned.
Fix the issue by checking of_clk_get_by_name return with !IS_ERR(clk),
and update of_clk_get and of_clk_get_by_name for !CONFIG_OF build
correspondingly.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Tested-by: Marek Vasut <marex@denx.de>
Tested-by: Lauri Hintsala <lauri.hintsala@bluegiga.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk/clkdev.c')
-rw-r--r-- | 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 20649b3c88fe..69085e02bd58 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(clk) && __clk_get(clk)) return clk; } |