aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorAlex Elder <alex.elder@linaro.org>2013-08-22 12:31:31 -0400
committerMike Turquette <mturquette@linaro.org>2013-08-27 19:05:39 -0400
commit7f7ed584d11be77a7521d170431bb14bc32a5980 (patch)
tree805ab187a9fce4b7c20170ceeffe9d074ea8da53 /drivers/clk
parent1ec5502ef20acc0af5c9172aac4652cd7cafd852 (diff)
clk: get matching entry under lock in of_clk_init()
Currently of_clk_init() finds a matching device node while holding the device tree spinlock. When a matching device node is found, the lock is dropped and then re-acquired in order to get a reference to the matching device id structure. Acquiring the spinlock twice is unnecessary (and it opens a vulnerable window that could conceivably lead to errors). There already exists an interface for both finding and taking a reference to a device id under lock, so use it. Signed-off-by: Alex Elder <elder@linaro.org> Reviewed-by: Christian Daudt <csd@broadcom.com> Reviewed-by: Markus Mayer <markus.mayer@linaro.org> Reviewed-by: Matt Porter <matt.porter@linaro.org> Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/clk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 7c4376289865..2db08c01ef51 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2228,13 +2228,13 @@ EXPORT_SYMBOL_GPL(of_clk_get_parent_name);
2228 */ 2228 */
2229void __init of_clk_init(const struct of_device_id *matches) 2229void __init of_clk_init(const struct of_device_id *matches)
2230{ 2230{
2231 const struct of_device_id *match;
2231 struct device_node *np; 2232 struct device_node *np;
2232 2233
2233 if (!matches) 2234 if (!matches)
2234 matches = __clk_of_table; 2235 matches = __clk_of_table;
2235 2236
2236 for_each_matching_node(np, matches) { 2237 for_each_matching_node_and_match(np, matches, &match) {
2237 const struct of_device_id *match = of_match_node(matches, np);
2238 of_clk_init_cb_t clk_init_cb = match->data; 2238 of_clk_init_cb_t clk_init_cb = match->data;
2239 clk_init_cb(np); 2239 clk_init_cb(np);
2240 } 2240 }