From 2cd0869672426171541330ecd7a39761a40b06a6 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 17 Apr 2019 16:55:12 +0100 Subject: [PATCH] staging: comedi: usbduxsigma: Call mutex_destroy() on private mutex `usbduxsigma_detach()` is the Comedi "detach" handler for the usbduxsigma 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 `usbduxsigma_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/usbduxsigma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index af5605a875e2..3cc40d2544be 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -1577,6 +1577,8 @@ static void usbduxsigma_detach(struct comedi_device *dev) usbduxsigma_free_usb_buffers(dev); mutex_unlock(&devpriv->mut); + + mutex_destroy(&devpriv->mut); } static struct comedi_driver usbduxsigma_driver = { -- 2.30.2