hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/power/supply/ds2782_battery.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * I2C client/driver for the Maxim/Dallas DS2782 Stand-Alone Fuel Gauge IC
34 *
....@@ -8,11 +9,6 @@
89 * DS2786 added by Yulia Vilensky <vilensky@compulab.co.il>
910 *
1011 * UEvent sending added by Evgeny Romanov <romanov@neurosoft.ru>
11
- *
12
- * This program is free software; you can redistribute it and/or modify
13
- * it under the terms of the GNU General Public License version 2 as
14
- * published by the Free Software Foundation.
15
- *
1612 */
1713
1814 #include <linux/kernel.h>
....@@ -319,17 +315,17 @@
319315 static int ds278x_battery_remove(struct i2c_client *client)
320316 {
321317 struct ds278x_info *info = i2c_get_clientdata(client);
318
+ int id = info->id;
322319
323320 power_supply_unregister(info->battery);
321
+ cancel_delayed_work_sync(&info->bat_work);
324322 kfree(info->battery_desc.name);
323
+ kfree(info);
325324
326325 mutex_lock(&battery_lock);
327
- idr_remove(&battery_id, info->id);
326
+ idr_remove(&battery_id, id);
328327 mutex_unlock(&battery_lock);
329328
330
- cancel_delayed_work(&info->bat_work);
331
-
332
- kfree(info);
333329 return 0;
334330 }
335331
....@@ -471,5 +467,5 @@
471467 module_i2c_driver(ds278x_battery_driver);
472468
473469 MODULE_AUTHOR("Ryan Mallon");
474
-MODULE_DESCRIPTION("Maxim/Dallas DS2782 Stand-Alone Fuel Gauage IC driver");
470
+MODULE_DESCRIPTION("Maxim/Dallas DS2782 Stand-Alone Fuel Gauge IC driver");
475471 MODULE_LICENSE("GPL");