diff options
author | Lee Jones <lee.jones@linaro.org> | 2013-01-16 04:17:13 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-02-05 07:54:24 -0500 |
commit | d41e35c364391d5c80467f62eecec8c4c65342f4 (patch) | |
tree | 3224cdc5919ef26abf57a6f7edde3c3edb151242 /drivers/pinctrl | |
parent | 83b423c885337415a680748cbd40f732734ab0b1 (diff) |
pinctrl/abx500: destroy mutex if returning early due to error
Current failure path neglects to mutex_destroy() before returning
an error due to an invalid parameter or an error received from
gpiochip_add(). This patch aims to remedy that behaviour.
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/pinctrl-abx500.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index 426b47cd6433..81ef5152714b 100644 --- a/drivers/pinctrl/pinctrl-abx500.c +++ b/drivers/pinctrl/pinctrl-abx500.c | |||
@@ -1155,11 +1155,13 @@ static int abx500_gpio_probe(struct platform_device *pdev) | |||
1155 | default: | 1155 | default: |
1156 | dev_err(&pdev->dev, "Unsupported pinctrl sub driver (%d)\n", | 1156 | dev_err(&pdev->dev, "Unsupported pinctrl sub driver (%d)\n", |
1157 | (int) platid->driver_data); | 1157 | (int) platid->driver_data); |
1158 | mutex_destroy(&pct->lock); | ||
1158 | return -EINVAL; | 1159 | return -EINVAL; |
1159 | } | 1160 | } |
1160 | 1161 | ||
1161 | if (!pct->soc) { | 1162 | if (!pct->soc) { |
1162 | dev_err(&pdev->dev, "Invalid SOC data\n"); | 1163 | dev_err(&pdev->dev, "Invalid SOC data\n"); |
1164 | mutex_destroy(&pct->lock); | ||
1163 | return -EINVAL; | 1165 | return -EINVAL; |
1164 | } | 1166 | } |
1165 | 1167 | ||
@@ -1176,6 +1178,7 @@ static int abx500_gpio_probe(struct platform_device *pdev) | |||
1176 | ret = gpiochip_add(&pct->chip); | 1178 | ret = gpiochip_add(&pct->chip); |
1177 | if (ret) { | 1179 | if (ret) { |
1178 | dev_err(&pdev->dev, "unable to add gpiochip: %d\n", ret); | 1180 | dev_err(&pdev->dev, "unable to add gpiochip: %d\n", ret); |
1181 | mutex_destroy(&pct->lock); | ||
1179 | goto out_rem_irq; | 1182 | goto out_rem_irq; |
1180 | } | 1183 | } |
1181 | dev_info(&pdev->dev, "added gpiochip\n"); | 1184 | dev_info(&pdev->dev, "added gpiochip\n"); |