clk: get matching entry under lock in of_clk_init()
authorAlex Elder <alex.elder@linaro.org>
Thu, 22 Aug 2013 16:31:31 +0000 (11:31 -0500)
committer黄涛 <huangtao@rock-chips.com>
Wed, 8 Jan 2014 03:04:34 +0000 (11:04 +0800)
commita79d253168c3ee65c474d67f362736e9efd46818
tree58d7b1e8808edbefd06869ecd19b825eddcf2fbc
parent36219fa9edc6b1edc83e2e39cbc97c19d55719b7
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>
drivers/clk/clk.c