Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ff7c1b8 authored by Miaoqian Lin's avatar Miaoqian Lin Committed by Greg Kroah-Hartman
Browse files

phy: mapphone-mdm6600: Fix PM error handling in phy_mdm6600_probe



[ Upstream commit d644e0d79829b1b9a14beedbdb0dc1256fc3677d ]

The pm_runtime_enable will increase power disable depth.
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable(). And use pm_runtime_dont_use_autosuspend() to
undo pm_runtime_use_autosuspend()
In the PM Runtime docs:
    Drivers in ->remove() callback should undo the runtime PM changes done
    in ->probe(). Usually this means calling pm_runtime_disable(),
    pm_runtime_dont_use_autosuspend() etc.

We should do this in error handling.

Fixes: f7f50b2a ("phy: mapphone-mdm6600: Add runtime PM support for n_gsm on USB suspend")
Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220301024615.31899-1-linmq006@gmail.com


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 59bdaed5
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -628,7 +628,8 @@ static int phy_mdm6600_probe(struct platform_device *pdev)
cleanup:
cleanup:
	if (error < 0)
	if (error < 0)
		phy_mdm6600_device_power_off(ddata);
		phy_mdm6600_device_power_off(ddata);

	pm_runtime_disable(ddata->dev);
	pm_runtime_dont_use_autosuspend(ddata->dev);
	return error;
	return error;
}
}