power: supply: max17040: Use devm_ to automate remove
authorIskren Chernev <iskren.chernev@gmail.com>
Tue, 22 Sep 2020 11:42:31 +0000 (14:42 +0300)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Sat, 3 Oct 2020 10:57:12 +0000 (12:57 +0200)
commite55a50613d91515acaddaca8de46162feb9adb45
tree12018bee81a8f71aeb6aebb69d08e137d6420290
parent05f94eb989075f6e5cd99d0772ea160efe41bff4
power: supply: max17040: Use devm_ to automate remove

Two actions were performed during remove - power supply dereg and
delayed work cleanup. Power supply dereg can be handled by using the
devm_ version of the registration function. Work cleanup can be added as
a devm_action.

If probe fails after psy registration it will now be cleaned up
properly.

Signed-off-by: Iskren Chernev <iskren.chernev@gmail.com>
Tested-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/max17040_battery.c