Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d41e35c3 authored by Lee Jones's avatar Lee Jones Committed by Linus Walleij
Browse files

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: default avatarLee Jones <lee.jones@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 83b423c8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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");