ChangeSet 1.946.3.20, 2002/12/27 10:38:45-08:00, pablo@menichini.com.ar [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. diff -Nru a/drivers/usb/input/pid.c b/drivers/usb/input/pid.c --- a/drivers/usb/input/pid.c Fri Dec 27 23:56:45 2002 +++ b/drivers/usb/input/pid.c Fri Dec 27 23:56:45 2002 @@ -133,6 +133,11 @@ /* 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");