staging: comedi: usbduxsigma: kill all urbs before freeing them
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 23 May 2013 19:56:12 +0000 (12:56 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 May 2013 11:40:58 +0000 (20:40 +0900)
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 <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/usbduxsigma.c

index 30ada7d8d935d7e9e572d22252bfad6b29e3b672..f85a477865dcea2340df12812a823ca1d9691b8c 100644 (file)
@@ -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);