[openwrt/openwrt] ath79: gpio-latch-mikrotik: use devm_mutex_init
LEDE Commits
lede-commits at lists.infradead.org
Mon Oct 7 06:15:31 PDT 2024
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/d51353db26f1e625fa95b36bc554902083dc72d3
commit d51353db26f1e625fa95b36bc554902083dc72d3
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Fri Oct 4 13:24:29 2024 -0700
ath79: gpio-latch-mikrotik: use devm_mutex_init
Avoids needing to call mutex_destroy in error paths, which is missing
anyway.
Signed-off-by: Rosen Penev <rosenp at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16620
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c b/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c
index 70f091b79f..6e3f0f9690 100644
--- a/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c
+++ b/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c
@@ -110,14 +110,19 @@ static int gpio_latch_probe(struct platform_device *pdev)
struct gpio_latch_chip *glc;
struct gpio_chip *gc;
struct device *dev = &pdev->dev;
- int i, n;
+ int err, i, n;
glc = devm_kzalloc(dev, sizeof(*glc), GFP_KERNEL);
if (!glc)
return -ENOMEM;
- mutex_init(&glc->mutex);
- mutex_init(&glc->latch_mutex);
+ err = devm_mutex_init(&pdev->dev, &glc->mutex);
+ if (err)
+ return err;
+
+ err = devm_mutex_init(&pdev->dev, &glc->latch_mutex);
+ if (err)
+ return err;
n = gpiod_count(dev, NULL);
if (n <= 0)
More information about the lede-commits
mailing list