Skip to content

Commit

Permalink
ath79: gpio-latch-mikrotik: use devm_mutex_init
Browse files Browse the repository at this point in the history
Avoids needing to call mutex_destroy in error paths, which is missing
anyway.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: openwrt#16620
Signed-off-by: Robert Marko <robimarko@gmail.com>
  • Loading branch information
neheb authored and robimarko committed Oct 7, 2024
1 parent 73d3789 commit d51353d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d51353d

Please sign in to comment.