Skip to content

Commit

Permalink
staging: comedi: dt9812: Call mutex_destroy() on private mutex
Browse files Browse the repository at this point in the history
`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>
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Apr 19, 2019
1 parent 6e11674 commit 7c2c182
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/staging/comedi/drivers/dt9812.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 7c2c182

Please sign in to comment.