Commit ef525199 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge

hid-input/battery: remove apparently redundant kmalloc

Signed-off-by: default avatarJeremy Fitzhardinge <jeremy@goop.org>
parent c5a92aa3
...@@ -287,7 +287,7 @@ static int hidinput_get_battery_property(struct power_supply *psy, ...@@ -287,7 +287,7 @@ static int hidinput_get_battery_property(struct power_supply *psy,
struct hid_device *dev = container_of(psy, struct hid_device, battery); struct hid_device *dev = container_of(psy, struct hid_device, battery);
int ret = 0; int ret = 0;
int ret_rep; int ret_rep;
__u8 *buf = NULL; __u8 buf[2] = {};
unsigned char report_number = dev->battery_report_id; unsigned char report_number = dev->battery_report_id;
switch (prop) { switch (prop) {
...@@ -297,14 +297,8 @@ static int hidinput_get_battery_property(struct power_supply *psy, ...@@ -297,14 +297,8 @@ static int hidinput_get_battery_property(struct power_supply *psy,
break; break;
case POWER_SUPPLY_PROP_CAPACITY: case POWER_SUPPLY_PROP_CAPACITY:
buf = kmalloc(2 * sizeof(__u8), GFP_KERNEL); ret_rep = dev->hid_get_raw_report(dev, report_number,
if (!buf) { buf, sizeof(buf), HID_FEATURE_REPORT);
ret = -ENOMEM;
break;
}
memset(buf, 0, sizeof(buf));
ret_rep = dev->hid_get_raw_report(dev, report_number, buf, sizeof(buf), HID_FEATURE_REPORT);
if (ret_rep != 2) { if (ret_rep != 2) {
ret = -EINVAL; ret = -EINVAL;
break; break;
...@@ -329,9 +323,6 @@ static int hidinput_get_battery_property(struct power_supply *psy, ...@@ -329,9 +323,6 @@ static int hidinput_get_battery_property(struct power_supply *psy,
break; break;
} }
if (buf) {
kfree(buf);
}
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment