Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 282350
b: refs/heads/master
c: ef52519
h: refs/heads/master
v: v3
  • Loading branch information
Jeremy Fitzhardinge committed Jan 8, 2012
1 parent 9e6ceae commit 2013c64
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c5a92aa3eb7425da68797a820d208edad36551f7
refs/heads/master: ef5251993c3597a88b893fe22ee830092dff35f9
15 changes: 3 additions & 12 deletions trunk/drivers/hid/hid-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
int ret = 0;
int ret_rep;
__u8 *buf = NULL;
__u8 buf[2] = {};
unsigned char report_number = dev->battery_report_id;

switch (prop) {
Expand All @@ -297,14 +297,8 @@ static int hidinput_get_battery_property(struct power_supply *psy,
break;

case POWER_SUPPLY_PROP_CAPACITY:
buf = kmalloc(2 * sizeof(__u8), GFP_KERNEL);
if (!buf) {
ret = -ENOMEM;
break;
}

memset(buf, 0, sizeof(buf));
ret_rep = dev->hid_get_raw_report(dev, report_number, buf, sizeof(buf), HID_FEATURE_REPORT);
ret_rep = dev->hid_get_raw_report(dev, report_number,
buf, sizeof(buf), HID_FEATURE_REPORT);
if (ret_rep != 2) {
ret = -EINVAL;
break;
Expand All @@ -329,9 +323,6 @@ static int hidinput_get_battery_property(struct power_supply *psy,
break;
}

if (buf) {
kfree(buf);
}
return ret;
}

Expand Down

0 comments on commit 2013c64

Please sign in to comment.