OpenCloudOS-Kernel/drivers/phy/ti
Hans de Goede 73224a5d21 phy: ti: tusb1210: Resolve charger-det crash if charger psy is unregistered
[ Upstream commit bf6e4ee5c43690e4c5a8a057bbcd4ff986bed052 ]

The power_supply frame-work is not really designed for there to be
long living in kernel references to power_supply devices.

Specifically unregistering a power_supply while some other code has
a reference to it triggers a WARN in power_supply_unregister():

	WARN_ON(atomic_dec_return(&psy->use_cnt));

Folllowed by the power_supply still getting removed and the
backing data freed anyway, leaving the tusb1210 charger-detect code
with a dangling reference, resulting in a crash the next time
tusb1210_get_online() is called.

Fix this by only holding the reference in tusb1210_get_online()
freeing it at the end of the function. Note this still leaves
a theoretical race window, but it avoids the issue when manually
rmmod-ing the charger chip driver during development.

Fixes: 48969a5623 ("phy: ti: tusb1210: Add charger detection")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20240406140821.18624-1-hdegoede@redhat.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-05-02 16:32:49 +02:00
..
Kconfig phy: ti: fix Kconfig warning and operator precedence 2023-01-11 13:24:33 +05:30
Makefile phy: ti: j721e-wiz: Add support for WIZ module present in TI J721E SoC 2020-01-14 10:50:19 +05:30
phy-am654-serdes.c phy: ti: am654-serdes: Add a determine_rate hook 2023-06-08 18:39:31 -07:00
phy-da8xx-usb.c phy: ti: phy-da8xx-usb: Convert to platform remove callback returning void 2023-03-20 18:14:58 +05:30
phy-dm816x-usb.c phy: ti: phy-dm816x-usb: Convert to platform remove callback returning void 2023-03-20 18:14:58 +05:30
phy-gmii-sel.c phy: ti: gmii-sel: Fix register offset when parent is not a syscon node 2024-01-10 17:16:56 +01:00
phy-j721e-wiz.c phy: ti: j721e-wiz: Add a determine_rate hook 2023-06-08 18:39:32 -07:00
phy-omap-control.c phy: ti: Use IS_ERR_OR_NULL() to clean code 2021-12-14 13:10:03 +05:30
phy-omap-usb2.c phy: ti: phy-omap-usb2: Fix NULL pointer dereference for SRP 2024-02-16 19:10:42 +01:00
phy-ti-pipe3.c phy: ti: phy-ti-pipe3: Convert to platform remove callback returning void 2023-03-20 18:14:58 +05:30
phy-tusb1210.c phy: ti: tusb1210: Resolve charger-det crash if charger psy is unregistered 2024-05-02 16:32:49 +02:00
phy-twl4030-usb.c phy: Explicitly include correct DT includes 2023-07-17 11:52:56 +05:30