summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/core.c
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2013-06-18 12:24:58 +0800
committerLinus Walleij <linus.walleij@linaro.org>2013-06-18 09:41:15 +0200
commitc8f50e8657a6dd8d6b2a596e4b4659fd77dc1718 (patch)
treed40fa36760ba5bfda9ee3e001c5cb6a16f51b86f /drivers/pinctrl/core.c
parent5a68e7a748c03127e6e54c353017cd19bffd2016 (diff)
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: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/core.c')
-rw-r--r--drivers/pinctrl/core.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 32eb7e2a3f34..d759889ead9a 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -465,7 +465,7 @@ struct pinctrl_gpio_range *
pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev,
unsigned int pin)
{
- struct pinctrl_gpio_range *range = NULL;
+ struct pinctrl_gpio_range *range;
mutex_lock(&pctldev->mutex);
/* Loop over the ranges */
@@ -475,17 +475,16 @@ pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev,
int a;
for (a = 0; a < range->npins; a++) {
if (range->pins[a] == pin)
- return range;
+ goto out;
}
} else if (pin >= range->pin_base &&
- pin < range->pin_base + range->npins) {
- mutex_unlock(&pctldev->mutex);
- return range;
- }
+ pin < range->pin_base + range->npins)
+ goto out;
}
+ range = NULL;
+out:
mutex_unlock(&pctldev->mutex);
-
- return NULL;
+ return range;
}
EXPORT_SYMBOL_GPL(pinctrl_find_gpio_range_from_pin);