staging: comedi: usbdux: Call mutex_destroy() on private mutex
authorIan Abbott <abbotti@mev.co.uk>
Wed, 17 Apr 2019 15:44:25 +0000 (16:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Apr 2019 12:59:37 +0000 (14:59 +0200)
`usbdux_detach()` is the Comedi "detach" handler for the usbdux 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()` are probably not
required, especially as the mutex is about to be destroyed, but leave
them alone for now.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/usbdux.c

index de177418190f54b1b7c8679ab3d60884be62a6fe..b8f54b7fb34a775fd5e589d7dcf7d68fe8765ea5 100644 (file)
@@ -1691,6 +1691,8 @@ static void usbdux_detach(struct comedi_device *dev)
        usbdux_free_usb_buffers(dev);
 
        mutex_unlock(&devpriv->mut);
+
+       mutex_destroy(&devpriv->mut);
 }
 
 static struct comedi_driver usbdux_driver = {