mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-05-26 11:40:24 +02:00
iio: dac: ad5592r: destroy mutexes in detach paths
The locks used here are initialized but never released which causes resource leaks with mutex debugging enabled. Add missing calls to mutex_destroy() or use devres if applicable. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250409-gpiochip-set-rv-iio-v2-1-4b36428f39cb@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
a34b88b48a
commit
0f8d8b3548
@@ -155,6 +155,8 @@ static void ad5592r_gpio_cleanup(struct ad5592r_state *st)
|
||||
{
|
||||
if (st->gpio_map)
|
||||
gpiochip_remove(&st->gpiochip);
|
||||
|
||||
mutex_destroy(&st->gpio_lock);
|
||||
}
|
||||
|
||||
static int ad5592r_reset(struct ad5592r_state *st)
|
||||
@@ -606,6 +608,10 @@ int ad5592r_probe(struct device *dev, const char *name,
|
||||
st->num_channels = 8;
|
||||
dev_set_drvdata(dev, iio_dev);
|
||||
|
||||
ret = devm_mutex_init(dev, &st->lock);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
st->reg = devm_regulator_get_optional(dev, "vref");
|
||||
if (IS_ERR(st->reg)) {
|
||||
if ((PTR_ERR(st->reg) != -ENODEV) && dev_fwnode(dev))
|
||||
@@ -622,8 +628,6 @@ int ad5592r_probe(struct device *dev, const char *name,
|
||||
iio_dev->info = &ad5592r_info;
|
||||
iio_dev->modes = INDIO_DIRECT_MODE;
|
||||
|
||||
mutex_init(&st->lock);
|
||||
|
||||
ad5592r_init_scales(st, ad5592r_get_vref(st));
|
||||
|
||||
ret = ad5592r_reset(st);
|
||||
|
||||
Reference in New Issue
Block a user