Commit f0059021 authored by Axel Lin's avatar Axel Lin Committed by Linus Walleij

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: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 031b8ce0
...@@ -392,6 +392,8 @@ static int pinctrl_get_device_gpio_range(unsigned gpio, ...@@ -392,6 +392,8 @@ static int pinctrl_get_device_gpio_range(unsigned gpio,
{ {
struct pinctrl_dev *pctldev = NULL; struct pinctrl_dev *pctldev = NULL;
mutex_lock(&pinctrldev_list_mutex);
/* Loop over the pin controllers */ /* Loop over the pin controllers */
list_for_each_entry(pctldev, &pinctrldev_list, node) { list_for_each_entry(pctldev, &pinctrldev_list, node) {
struct pinctrl_gpio_range *range; struct pinctrl_gpio_range *range;
...@@ -400,10 +402,13 @@ static int pinctrl_get_device_gpio_range(unsigned gpio, ...@@ -400,10 +402,13 @@ static int pinctrl_get_device_gpio_range(unsigned gpio,
if (range != NULL) { if (range != NULL) {
*outdev = pctldev; *outdev = pctldev;
*outrange = range; *outrange = range;
mutex_unlock(&pinctrldev_list_mutex);
return 0; return 0;
} }
} }
mutex_unlock(&pinctrldev_list_mutex);
return -EPROBE_DEFER; return -EPROBE_DEFER;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment