Skip to content

Commit 00bd6bc

Browse files
Zhang Qilonggregkh
authored andcommitted
USB: apple-mfi-fastcharge: fix reference leak in apple_mfi_fc_set_property
pm_runtime_get_sync() will increment pm usage at first and it will resume the device later. If runtime of the device has error or device is in inaccessible state(or other error state), resume operation will fail. If we do not call put operation to decrease the reference, the result is that this device cannot enter the idle state and always stay busy or other non-idle state. Fixes: 249fa82 ("USB: Add driver to control USB fast charge for iOS devices") Signed-off-by: Zhang Qilong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2091491 commit 00bd6bc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/usb/misc/apple-mfi-fastcharge.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,10 @@ static int apple_mfi_fc_set_property(struct power_supply *psy,
120120
dev_dbg(&mfi->udev->dev, "prop: %d\n", psp);
121121

122122
ret = pm_runtime_get_sync(&mfi->udev->dev);
123-
if (ret < 0)
123+
if (ret < 0) {
124+
pm_runtime_put_noidle(&mfi->udev->dev);
124125
return ret;
126+
}
125127

126128
switch (psp) {
127129
case POWER_SUPPLY_PROP_CHARGE_TYPE:

0 commit comments

Comments
 (0)