From: Lee Jones Date: Wed, 16 Jan 2013 09:17:13 +0000 (+0000) Subject: pinctrl/abx500: destroy mutex if returning early due to error X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d41e35c364391d5c80467f62eecec8c4c65342f4;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git 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 Signed-off-by: Linus Walleij --- diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index 426b47cd643..81ef5152714 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) 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; } @@ -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");