staging: comedi: usbduxfast: Call mutex_destroy() on private mutex
authorIan Abbott <abbotti@mev.co.uk>
Wed, 17 Apr 2019 15:50:09 +0000 (16:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Apr 2019 12:59:36 +0000 (14:59 +0200)
`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 <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/usbduxfast.c

index 0d54f39..04bc488 100644 (file)
@@ -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 = {