From: Bartosz Golaszewski bartosz.golaszewski@linaro.org
We initialize the data->mutex in gpiod_export() but lack the corresponding mutex_destroy() in gpiod_unexport() causing a resource leak with mutex debugging enabled. Add the call right before kfreeing the GPIO data.
Fixes: 6ffcb7971486 ("gpio: sysfs: use per-gpio locking") Cc: stable@vger.kernel.org Signed-off-by: Bartosz Golaszewski bartosz.golaszewski@linaro.org --- drivers/gpio/gpiolib-sysfs.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index 4a3aa09dad9d..cd3381a4bc93 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -713,6 +713,7 @@ void gpiod_unexport(struct gpio_desc *desc) }
put_device(dev); + mutex_destroy(&data->mutex); kfree(data); } EXPORT_SYMBOL_GPL(gpiod_unexport);