From: Axel Lin Date: Sun, 18 Aug 2013 12:40:29 +0000 (+0800) Subject: pinctrl: core: Hold pctldev->mutex mutex lock while traversing gpio_ranges list X-Git-Tag: upstream/snapshot3+hdmi~4441^2~34 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ffbe2e613873222474a0f575296187002a8995d;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git pinctrl: core: Hold pctldev->mutex mutex lock while traversing gpio_ranges list Hold pctldev->mutex mutex_lock when traverse the list. Signed-off-by: Axel Lin Signed-off-by: Linus Walleij --- diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index ff06582..faeb872 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -357,14 +357,17 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio) /* Loop over the pin controllers */ list_for_each_entry(pctldev, &pinctrldev_list, node) { /* Loop over the ranges */ + mutex_lock(&pctldev->mutex); list_for_each_entry(range, &pctldev->gpio_ranges, node) { /* Check if any gpio range overlapped with gpio chip */ if (range->base + range->npins - 1 < chip->base || range->base > chip->base + chip->ngpio - 1) continue; + mutex_unlock(&pctldev->mutex); mutex_unlock(&pinctrldev_list_mutex); return true; } + mutex_unlock(&pctldev->mutex); } mutex_unlock(&pinctrldev_list_mutex);