From 35756f3dbf4347b8e4b7dcd781da887cafab4786 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 17 Apr 2019 16:50:09 +0100 Subject: staging: comedi: usbduxfast: Call mutex_destroy() on private mutex `usbduxfast_detach()` is the Comedi "detach" handler for the usbduxfast driver. When it is called, the private data for the device is about to be freed. The private date contains a mutex `devpriv->mut` that was initialized when the private data was allocated. Call `mutex_destroy()` to mark it as invalid. The calls to `mutex_lock()` and `mutex_unlock()` in `usbduxfast_detach()` are probably not required, especially as the mutex is about to be destroyed, but leave them alone for now. Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxfast.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers') diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 0d54f394dbd2..04bc488385e6 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -993,6 +993,8 @@ static void usbduxfast_detach(struct comedi_device *dev) kfree(devpriv->duxbuf); mutex_unlock(&devpriv->mut); + + mutex_destroy(&devpriv->mut); } static struct comedi_driver usbduxfast_driver = { -- cgit v1.2.3