]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
staging: comedi: dt9812: Call mutex_destroy() on private mutex
authorIan Abbott <abbotti@mev.co.uk>
Wed, 17 Apr 2019 15:16:11 +0000 (16:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Apr 2019 12:59:37 +0000 (14:59 +0200)
`dt9812_detach()` is the Comedi "detach" handler for the dt9812 driver.
When it is called, the private data for the device is about to be freed.
The private data contains a mutex `devpriv->mut` that was initialized
when the private data was allocated.  Call `mutex_destroy()` to mark it
as invalid.

Also remove the calls to `mutex_lock()` and `mutex_unlock()` from
`dt9812_detach()` as the mutex is only being used around a call to
`usb_set_intfdata()` to clear the USB interface's driver data pointer.
The mutex lock seems redundant here, especially as it is about to be
destroyed.

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

index 9f165f1cefa5616df5abc2bb3aad31617b45dae8..634f57730c1e02208853ae2b698c697c450e497d 100644 (file)
@@ -835,11 +835,8 @@ static void dt9812_detach(struct comedi_device *dev)
        if (!devpriv)
                return;
 
-       mutex_lock(&devpriv->mut);
-
+       mutex_destroy(&devpriv->mut);
        usb_set_intfdata(intf, NULL);
-
-       mutex_unlock(&devpriv->mut);
 }
 
 static struct comedi_driver dt9812_driver = {