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@gmail.com> Link: https://github.com/openwrt/openwrt/pull/16620 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
73d3789e67
commit
d51353db26
@ -110,14 +110,19 @@ static int gpio_latch_probe(struct platform_device *pdev)
|
|||||||
struct gpio_latch_chip *glc;
|
struct gpio_latch_chip *glc;
|
||||||
struct gpio_chip *gc;
|
struct gpio_chip *gc;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
int i, n;
|
int err, i, n;
|
||||||
|
|
||||||
glc = devm_kzalloc(dev, sizeof(*glc), GFP_KERNEL);
|
glc = devm_kzalloc(dev, sizeof(*glc), GFP_KERNEL);
|
||||||
if (!glc)
|
if (!glc)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
mutex_init(&glc->mutex);
|
err = devm_mutex_init(&pdev->dev, &glc->mutex);
|
||||||
mutex_init(&glc->latch_mutex);
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
err = devm_mutex_init(&pdev->dev, &glc->latch_mutex);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
n = gpiod_count(dev, NULL);
|
n = gpiod_count(dev, NULL);
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user