Commit e95cd247 authored by Pablo Menichini's avatar Pablo Menichini Committed by Vojtech Pavlik

[PATCH] Handle kmalloc fails: drivers/usb/input/pid.c

This patch tries to check the return value of kmalloc taking the necesary
action to solve the problem.
parent ab7d78b4
......@@ -133,6 +133,11 @@ static int hid_pid_erase(struct input_dev *dev, int id)
/* Find field */
field = (struct hid_field *) kmalloc(sizeof(struct hid_field), GFP_KERNEL);
if(!field) {
printk("Couldn't allocate field\n");
return -ENOMEM;
}
ret = hid_set_field(field, ret, pid->effects[id].device_id);
if(!ret) {
printk("Couldn't set field\n");
......
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