From: H Hartley Sweeten Date: Thu, 23 May 2013 19:56:12 +0000 (-0700) Subject: staging: comedi: usbduxsigma: kill all urbs before freeing them X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=988f5541dbae1f28e0e317f04963aa0c0068520e;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: comedi: usbduxsigma: kill all urbs before freeing them For aesthetic reasons, kill all the urbs before freeing them. Also, remove a redundant killing of the ai and ao urbs in the (*detach). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 30ada7d8d935..f85a477865dc 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -1521,9 +1521,12 @@ static void tidy_up(struct usbduxsigma_private *usbduxsub_tmp) { int i; + /* force unlink all urbs */ + usbdux_ai_stop(usbduxsub_tmp, 1); + usbdux_ao_stop(usbduxsub_tmp, 1); + usbdux_pwm_stop(usbduxsub_tmp, 1); + if (usbduxsub_tmp->urbIn) { - /* force unlink all urbs */ - usbdux_ai_stop(usbduxsub_tmp, 1); for (i = 0; i < usbduxsub_tmp->numOfInBuffers; i++) { kfree(usbduxsub_tmp->urbIn[i]->transfer_buffer); usbduxsub_tmp->urbIn[i]->transfer_buffer = NULL; @@ -1534,8 +1537,6 @@ static void tidy_up(struct usbduxsigma_private *usbduxsub_tmp) usbduxsub_tmp->urbIn = NULL; } if (usbduxsub_tmp->urbOut) { - /* force unlink all urbs */ - usbdux_ao_stop(usbduxsub_tmp, 1); for (i = 0; i < usbduxsub_tmp->numOfOutBuffers; i++) { if (usbduxsub_tmp->urbOut[i]->transfer_buffer) { kfree(usbduxsub_tmp-> @@ -1552,8 +1553,6 @@ static void tidy_up(struct usbduxsigma_private *usbduxsub_tmp) usbduxsub_tmp->urbOut = NULL; } if (usbduxsub_tmp->urbPwm) { - /* force unlink urb */ - usbdux_pwm_stop(usbduxsub_tmp, 1); kfree(usbduxsub_tmp->urbPwm->transfer_buffer); usbduxsub_tmp->urbPwm->transfer_buffer = NULL; usb_free_urb(usbduxsub_tmp->urbPwm); @@ -1849,10 +1848,6 @@ static void usbduxsigma_detach(struct comedi_device *dev) if (!devpriv) return; - /* stop any running commands */ - usbdux_ai_stop(devpriv, devpriv->ai_cmd_running); - usbdux_ao_stop(devpriv, devpriv->ao_cmd_running); - usb_set_intfdata(intf, NULL); down(&devpriv->sem);