Skip to content

Commit

Permalink
pinctrl/abx500: destroy mutex if returning early due to error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lee Jones authored and Linus Walleij committed Feb 5, 2013
1 parent 83b423c commit d41e35c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/pinctrl/pinctrl-abx500.c
Original file line number Diff line number Diff line change
Expand Up @@ -1155,11 +1155,13 @@ static int abx500_gpio_probe(struct platform_device *pdev)
default:
dev_err(&pdev->dev, "Unsupported pinctrl sub driver (%d)\n",
(int) platid->driver_data);
mutex_destroy(&pct->lock);
return -EINVAL;
}

if (!pct->soc) {
dev_err(&pdev->dev, "Invalid SOC data\n");
mutex_destroy(&pct->lock);
return -EINVAL;
}

Expand All @@ -1176,6 +1178,7 @@ static int abx500_gpio_probe(struct platform_device *pdev)
ret = gpiochip_add(&pct->chip);
if (ret) {
dev_err(&pdev->dev, "unable to add gpiochip: %d\n", ret);
mutex_destroy(&pct->lock);
goto out_rem_irq;
}
dev_info(&pdev->dev, "added gpiochip\n");
Expand Down

0 comments on commit d41e35c

Please sign in to comment.