arm: tegra: xmm: check return value of autopm_get
Shawn Joo [Mon, 12 Mar 2012 22:47:36 +0000 (07:47 +0900)]
check return value of usb_autopm_get_interface().
if return value is not success, usb_autopm_put_interface() should
not be called to make up the reference count.

Bug 936094

Signed-off-by: Shawn Joo <sjoo@nvidia.com>
Reviewed-on: http://git-master/r/85974
(cherry picked from commit aad2bf5c8fef639465c4bb895b73a23c3f0c0403)

Change-Id: Ifd1deb1e0953eae1fd8d41f48989b650d6951fed
Reviewed-on: http://git-master/r/97647
Reviewed-by: Shawn Joo <sjoo@nvidia.com>
Tested-by: Shawn Joo <sjoo@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Steve Lin <stlin@nvidia.com>

arch/arm/mach-tegra/baseband-xmm-power.c

index 13210bd..7659d4f 100644 (file)
@@ -639,8 +639,8 @@ static void baseband_xmm_power_autopm_resume(struct work_struct *work)
                        usb_unlock_device(usbdev);
                        return;
                }
-               usb_autopm_get_interface(intf);
-               usb_autopm_put_interface(intf);
+               if (usb_autopm_get_interface(intf) == 0)
+                       usb_autopm_put_interface(intf);
                usb_unlock_device(usbdev);
        }
 }