Commit 5ffbe2e6 authored by Axel Lin's avatar Axel Lin Committed by Linus Walleij

pinctrl: core: Hold pctldev->mutex mutex lock while traversing gpio_ranges list

Hold pctldev->mutex mutex_lock when traverse the list.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent f0059021
...@@ -357,14 +357,17 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio) ...@@ -357,14 +357,17 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio)
/* 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) {
/* Loop over the ranges */ /* Loop over the ranges */
mutex_lock(&pctldev->mutex);
list_for_each_entry(range, &pctldev->gpio_ranges, node) { list_for_each_entry(range, &pctldev->gpio_ranges, node) {
/* Check if any gpio range overlapped with gpio chip */ /* Check if any gpio range overlapped with gpio chip */
if (range->base + range->npins - 1 < chip->base || if (range->base + range->npins - 1 < chip->base ||
range->base > chip->base + chip->ngpio - 1) range->base > chip->base + chip->ngpio - 1)
continue; continue;
mutex_unlock(&pctldev->mutex);
mutex_unlock(&pinctrldev_list_mutex); mutex_unlock(&pinctrldev_list_mutex);
return true; return true;
} }
mutex_unlock(&pctldev->mutex);
} }
mutex_unlock(&pinctrldev_list_mutex); mutex_unlock(&pinctrldev_list_mutex);
......
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