diff options
author | Andrew Davis <afd@ti.com> | 2024-01-23 19:36:33 +0300 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2024-01-27 03:23:40 +0300 |
commit | 98be59bd03aa50d155ba84208cd964017e397fc9 (patch) | |
tree | 69f4b0d87e10a208034b9599f3d7702131ad72d8 /drivers/power | |
parent | b282c30dad3e10738a4f03043efaff93d9e8de02 (diff) | |
download | linux-98be59bd03aa50d155ba84208cd964017e397fc9.tar.xz |
power: supply: da9030: Use devm_power_supply_register() helper
Use the device lifecycle managed register function. This helps prevent
mistakes like unregistering out of order in cleanup functions and
forgetting to unregister on error paths.
Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240123163653.384385-2-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/da9030_battery.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/power/supply/da9030_battery.c b/drivers/power/supply/da9030_battery.c index 581cf956d2d2..04e0f4162d42 100644 --- a/drivers/power/supply/da9030_battery.c +++ b/drivers/power/supply/da9030_battery.c @@ -530,8 +530,9 @@ static int da9030_battery_probe(struct platform_device *pdev) da9030_battery_setup_psy(charger); psy_cfg.drv_data = charger; - charger->psy = power_supply_register(&pdev->dev, &charger->psy_desc, - &psy_cfg); + charger->psy = devm_power_supply_register(&pdev->dev, + &charger->psy_desc, + &psy_cfg); if (IS_ERR(charger->psy)) { ret = PTR_ERR(charger->psy); goto err_ps_register; @@ -563,7 +564,6 @@ static void da9030_battery_remove(struct platform_device *dev) DA9030_EVENT_CHIOVER | DA9030_EVENT_TBAT); cancel_delayed_work_sync(&charger->work); da9030_set_charge(charger, 0); - power_supply_unregister(charger->psy); } static struct platform_driver da903x_battery_driver = { |