aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-input.c
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2011-12-02 13:04:04 -0500
committerJeremy Fitzhardinge <jeremy@goop.org>2012-01-08 02:30:36 -0500
commitef5251993c3597a88b893fe22ee830092dff35f9 (patch)
tree279e3ef4fe2057685a84339eda0a21493dbd6627 /drivers/hid/hid-input.c
parentc5a92aa3eb7425da68797a820d208edad36551f7 (diff)
hid-input/battery: remove apparently redundant kmalloc
Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org>
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r--drivers/hid/hid-input.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 8fac47cf42f1..b108ce71583f 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -287,7 +287,7 @@ static int hidinput_get_battery_property(struct power_supply *psy,
287 struct hid_device *dev = container_of(psy, struct hid_device, battery); 287 struct hid_device *dev = container_of(psy, struct hid_device, battery);
288 int ret = 0; 288 int ret = 0;
289 int ret_rep; 289 int ret_rep;
290 __u8 *buf = NULL; 290 __u8 buf[2] = {};
291 unsigned char report_number = dev->battery_report_id; 291 unsigned char report_number = dev->battery_report_id;
292 292
293 switch (prop) { 293 switch (prop) {
@@ -297,14 +297,8 @@ static int hidinput_get_battery_property(struct power_supply *psy,
297 break; 297 break;
298 298
299 case POWER_SUPPLY_PROP_CAPACITY: 299 case POWER_SUPPLY_PROP_CAPACITY:
300 buf = kmalloc(2 * sizeof(__u8), GFP_KERNEL); 300 ret_rep = dev->hid_get_raw_report(dev, report_number,
301 if (!buf) { 301 buf, sizeof(buf), HID_FEATURE_REPORT);
302 ret = -ENOMEM;
303 break;
304 }
305
306 memset(buf, 0, sizeof(buf));
307 ret_rep = dev->hid_get_raw_report(dev, report_number, buf, sizeof(buf), HID_FEATURE_REPORT);
308 if (ret_rep != 2) { 302 if (ret_rep != 2) {
309 ret = -EINVAL; 303 ret = -EINVAL;
310 break; 304 break;
@@ -329,9 +323,6 @@ static int hidinput_get_battery_property(struct power_supply *psy,
329 break; 323 break;
330 } 324 }
331 325
332 if (buf) {
333 kfree(buf);
334 }
335 return ret; 326 return ret;
336} 327}
337 328