Commit 00bd6bca authored by Zhang Qilong's avatar Zhang Qilong Committed by Greg Kroah-Hartman

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: 249fa821 ("USB: Add driver to control USB fast charge for iOS devices")
Signed-off-by: default avatarZhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201102022650.67115-1-zhangqilong3@huawei.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 20914919
...@@ -120,8 +120,10 @@ static int apple_mfi_fc_set_property(struct power_supply *psy, ...@@ -120,8 +120,10 @@ static int apple_mfi_fc_set_property(struct power_supply *psy,
dev_dbg(&mfi->udev->dev, "prop: %d\n", psp); dev_dbg(&mfi->udev->dev, "prop: %d\n", psp);
ret = pm_runtime_get_sync(&mfi->udev->dev); ret = pm_runtime_get_sync(&mfi->udev->dev);
if (ret < 0) if (ret < 0) {
pm_runtime_put_noidle(&mfi->udev->dev);
return ret; return ret;
}
switch (psp) { switch (psp) {
case POWER_SUPPLY_PROP_CHARGE_TYPE: case POWER_SUPPLY_PROP_CHARGE_TYPE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment