aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-01-31 06:06:33 -0500
committerLinus Walleij <linus.walleij@linaro.org>2013-02-06 16:38:31 -0500
commitfa1ec996ac1a42e46ec7dca089252f124c81d7bd (patch)
treef426273718c901003868953b3e76137a8e9d493d /drivers/pinctrl
parentd8a7c1f134edda4ac17a99fffc1159a65a3866a7 (diff)
pinctrl/abx500: prevent error path from corrupting returning error
Prior to this patch abx500_gpio_probe() would return the return-value of gpiochip_remove() during its error patch regardless of what the actual failure was. So as long as gpiochip_remove() succeeded, probe() would look like it succeeded too. This patch ensures the correct error value is returned and that mutex_destroy() is invoked if gpiochip_add_pin_range() were to fail. 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.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c
index 81ef5152714b..9bdfcb97ef57 100644
--- a/drivers/pinctrl/pinctrl-abx500.c
+++ b/drivers/pinctrl/pinctrl-abx500.c
@@ -1111,7 +1111,7 @@ static int abx500_gpio_probe(struct platform_device *pdev)
1111 struct abx500_gpio_platform_data *pdata; 1111 struct abx500_gpio_platform_data *pdata;
1112 struct abx500_pinctrl *pct; 1112 struct abx500_pinctrl *pct;
1113 const struct platform_device_id *platid = platform_get_device_id(pdev); 1113 const struct platform_device_id *platid = platform_get_device_id(pdev);
1114 int ret; 1114 int ret, err;
1115 int i; 1115 int i;
1116 1116
1117 pdata = abx500_pdata->gpio; 1117 pdata = abx500_pdata->gpio;
@@ -1189,6 +1189,7 @@ static int abx500_gpio_probe(struct platform_device *pdev)
1189 if (!pct->pctldev) { 1189 if (!pct->pctldev) {
1190 dev_err(&pdev->dev, 1190 dev_err(&pdev->dev,
1191 "could not register abx500 pinctrl driver\n"); 1191 "could not register abx500 pinctrl driver\n");
1192 ret = -EINVAL;
1192 goto out_rem_chip; 1193 goto out_rem_chip;
1193 } 1194 }
1194 dev_info(&pdev->dev, "registered pin controller\n"); 1195 dev_info(&pdev->dev, "registered pin controller\n");
@@ -1201,7 +1202,7 @@ static int abx500_gpio_probe(struct platform_device *pdev)
1201 dev_name(&pdev->dev), 1202 dev_name(&pdev->dev),
1202 p->offset - 1, p->offset, p->npins); 1203 p->offset - 1, p->offset, p->npins);
1203 if (ret < 0) 1204 if (ret < 0)
1204 return ret; 1205 goto out_rem_chip;
1205 } 1206 }
1206 1207
1207 platform_set_drvdata(pdev, pct); 1208 platform_set_drvdata(pdev, pct);
@@ -1210,8 +1211,8 @@ static int abx500_gpio_probe(struct platform_device *pdev)
1210 return 0; 1211 return 0;
1211 1212
1212out_rem_chip: 1213out_rem_chip:
1213 ret = gpiochip_remove(&pct->chip); 1214 err = gpiochip_remove(&pct->chip);
1214 if (ret) 1215 if (err)
1215 dev_info(&pdev->dev, "failed to remove gpiochip\n"); 1216 dev_info(&pdev->dev, "failed to remove gpiochip\n");
1216out_rem_irq: 1217out_rem_irq:
1217 abx500_gpio_irq_remove(pct); 1218 abx500_gpio_irq_remove(pct);