Bluetooth: fix crash with quirky dongles doing sound
authorOliver Neukum <oneukum@suse.de>
Fri, 11 Feb 2011 12:00:06 +0000 (13:00 +0100)
committerGustavo F. Padovan <padovan@profusion.mobi>
Wed, 16 Feb 2011 18:53:45 +0000 (15:53 -0300)
Quirky dongles sometimes do not use the iso interface which
causes a crash with runtime PM

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
drivers/bluetooth/btusb.c

index 4cefa91e6c34782bf57ef4769c747f94a23e8696..664f1cc9f8d4f7aec94ea401785cf856c62576b2 100644 (file)
@@ -829,7 +829,7 @@ static void btusb_work(struct work_struct *work)
 
        if (hdev->conn_hash.sco_num > 0) {
                if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) {
-                       err = usb_autopm_get_interface(data->isoc);
+                       err = usb_autopm_get_interface(data->isoc ? data->isoc : data->intf);
                        if (err < 0) {
                                clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
                                usb_kill_anchored_urbs(&data->isoc_anchor);
@@ -858,7 +858,7 @@ static void btusb_work(struct work_struct *work)
 
                __set_isoc_interface(hdev, 0);
                if (test_and_clear_bit(BTUSB_DID_ISO_RESUME, &data->flags))
-                       usb_autopm_put_interface(data->isoc);
+                       usb_autopm_put_interface(data->isoc ? data->isoc : data->intf);
        }
 }