usb_wwan: fix error case in close()
authorOliver Neukum <oliver@neukum.org>
Thu, 10 Feb 2011 14:33:37 +0000 (15:33 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 17 Feb 2011 18:51:13 +0000 (10:51 -0800)
The device never needs to be resumed in close(). But the counters
must be balanced. As resumption can fail, but the counters must
be balanced, use the _no_resume() version which cannot fail.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/usb_wwan.c

index fe5e48eb9693bf70b0dde39c702dde6017bc5c65..817e6ff8de8bc8aebd549697bd3b090315753281 100644 (file)
@@ -424,6 +424,7 @@ int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port)
        spin_lock_irq(&intfdata->susp_lock);
        portdata->opened = 1;
        spin_unlock_irq(&intfdata->susp_lock);
+       /* this balances a get in the generic USB serial code */
        usb_autopm_put_interface(serial->interface);
 
        return 0;
@@ -450,7 +451,8 @@ void usb_wwan_close(struct usb_serial_port *port)
                        usb_kill_urb(portdata->in_urbs[i]);
                for (i = 0; i < N_OUT_URB; i++)
                        usb_kill_urb(portdata->out_urbs[i]);
-               usb_autopm_get_interface(serial->interface);
+               /* balancing - important as an error cannot be handled*/
+               usb_autopm_get_interface_no_resume(serial->interface);
                serial->interface->needs_remote_wakeup = 0;
        }
 }