summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/core.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-08-18 20:34:22 +0800
committerLinus Walleij <linus.walleij@linaro.org>2013-08-23 08:56:27 +0200
commitf0059021084137b4ffd2ffc7ee4b62a895c4c84a (patch)
tree1ee24558547d5aebe9b5ce2a93ecc330738c7e68 /drivers/pinctrl/core.c
parent031b8ce01b93aca6f3fb8982994f7015a9f73953 (diff)
pinctrl: core: Hold pinctrldev_list_mutex mutex while traversing pinctrldev_list
This one is missed in commit 44d5f7bb "pinctrl: sink pinctrldev_list_mutex". Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/core.c')
-rw-r--r--drivers/pinctrl/core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index a97b717e3ad3..ff06582103c0 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -392,6 +392,8 @@ static int pinctrl_get_device_gpio_range(unsigned gpio,
{
struct pinctrl_dev *pctldev = NULL;
+ mutex_lock(&pinctrldev_list_mutex);
+
/* Loop over the pin controllers */
list_for_each_entry(pctldev, &pinctrldev_list, node) {
struct pinctrl_gpio_range *range;
@@ -400,10 +402,13 @@ static int pinctrl_get_device_gpio_range(unsigned gpio,
if (range != NULL) {
*outdev = pctldev;
*outrange = range;
+ mutex_unlock(&pinctrldev_list_mutex);
return 0;
}
}
+ mutex_unlock(&pinctrldev_list_mutex);
+
return -EPROBE_DEFER;
}