summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/hid/hid-input.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/hid/hid-input.c')
-rw-r--r--kernel/drivers/hid/hid-input.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/drivers/hid/hid-input.c b/kernel/drivers/hid/hid-input.c
index 008e89bf6..32d52d29c 100644
--- a/kernel/drivers/hid/hid-input.c
+++ b/kernel/drivers/hid/hid-input.c
@@ -462,12 +462,15 @@ out:
static void hidinput_cleanup_battery(struct hid_device *dev)
{
+ const struct power_supply_desc *psy_desc;
+
if (!dev->battery)
return;
+ psy_desc = dev->battery->desc;
power_supply_unregister(dev->battery);
- kfree(dev->battery->desc->name);
- kfree(dev->battery->desc);
+ kfree(psy_desc->name);
+ kfree(psy_desc);
dev->battery = NULL;
}
#else /* !CONFIG_HID_BATTERY_STRENGTH */