diff options
| author | Shawn Guo <shawn.guo@linaro.org> | 2012-07-17 23:52:22 -0400 |
|---|---|---|
| committer | Mike Turquette <mturquette@linaro.org> | 2012-07-19 17:07:45 -0400 |
| commit | 9f1612d351a8e57d3d694e828641d3e4eeb224f8 (patch) | |
| tree | 454f1194686043575369eb66fa02075036f17b59 /include/linux | |
| parent | c782c384d289a382baf4a1ab544f6f4b9e72405b (diff) | |
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 'include/linux')
| -rw-r--r-- | include/linux/clk.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h index 8b70342e7e0b..071e24083dc8 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #ifndef __LINUX_CLK_H | 12 | #ifndef __LINUX_CLK_H |
| 13 | #define __LINUX_CLK_H | 13 | #define __LINUX_CLK_H |
| 14 | 14 | ||
| 15 | #include <linux/err.h> | ||
| 15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
| 16 | #include <linux/notifier.h> | 17 | #include <linux/notifier.h> |
| 17 | 18 | ||
| @@ -320,12 +321,12 @@ struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec); | |||
| 320 | #else | 321 | #else |
| 321 | static inline struct clk *of_clk_get(struct device_node *np, int index) | 322 | static inline struct clk *of_clk_get(struct device_node *np, int index) |
| 322 | { | 323 | { |
| 323 | return NULL; | 324 | return ERR_PTR(-ENOENT); |
| 324 | } | 325 | } |
| 325 | static inline struct clk *of_clk_get_by_name(struct device_node *np, | 326 | static inline struct clk *of_clk_get_by_name(struct device_node *np, |
| 326 | const char *name) | 327 | const char *name) |
| 327 | { | 328 | { |
| 328 | return NULL; | 329 | return ERR_PTR(-ENOENT); |
| 329 | } | 330 | } |
| 330 | #endif | 331 | #endif |
| 331 | 332 | ||
