提交 c8f50e86 编写于 作者: W Wei Yongjun 提交者: Linus Walleij

pinctrl: core: fix missing unlock on error in pinctrl_find_gpio_range_from_pin()

Add the missing unlock before return from function pinctrl_find_gpio_range_from_pin()
in the error handling case.

Introduced by commit 2ff3477efd7086544b9e298fc63afab0645921b4.
(pinctrl: add pin list based GPIO ranges)
Signed-off-by: NWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 5a68e7a7
...@@ -465,7 +465,7 @@ struct pinctrl_gpio_range * ...@@ -465,7 +465,7 @@ struct pinctrl_gpio_range *
pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev, pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev,
unsigned int pin) unsigned int pin)
{ {
struct pinctrl_gpio_range *range = NULL; struct pinctrl_gpio_range *range;
mutex_lock(&pctldev->mutex); mutex_lock(&pctldev->mutex);
/* Loop over the ranges */ /* Loop over the ranges */
...@@ -475,17 +475,16 @@ pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev, ...@@ -475,17 +475,16 @@ pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev,
int a; int a;
for (a = 0; a < range->npins; a++) { for (a = 0; a < range->npins; a++) {
if (range->pins[a] == pin) if (range->pins[a] == pin)
return range; goto out;
} }
} else if (pin >= range->pin_base && } else if (pin >= range->pin_base &&
pin < range->pin_base + range->npins) { pin < range->pin_base + range->npins)
mutex_unlock(&pctldev->mutex); goto out;
return range;
}
} }
range = NULL;
out:
mutex_unlock(&pctldev->mutex); mutex_unlock(&pctldev->mutex);
return range;
return NULL;
} }
EXPORT_SYMBOL_GPL(pinctrl_find_gpio_range_from_pin); EXPORT_SYMBOL_GPL(pinctrl_find_gpio_range_from_pin);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册