On Fri, Jan 06, 2006 at 08:54:29PM +0100, Oliver Neukum wrote:
> Hi,
> 
> this uses kzalloc in hid.

OK.

>       Regards
>               Oliver
> 
> Signed-off-by: Oliver Neukum <[EMAIL PROTECTED]>
Signed-off-by: Vojtech Pavlik <[EMAIL PROTECTED]>


> 
> --- linux-2.6.15-vanilla/drivers/usb/input/hid-core.c 2006-01-03 
> 04:21:10.000000000 +0100
> +++ linux-2.6.15/drivers/usb/input/hid-core.c 2006-01-06 20:39:00.000000000 
> +0100
> @@ -66,9 +66,8 @@
>       if (report_enum->report_id_hash[id])
>               return report_enum->report_id_hash[id];
>  
> -     if (!(report = kmalloc(sizeof(struct hid_report), GFP_KERNEL)))
> +     if (!(report = kzalloc(sizeof(struct hid_report), GFP_KERNEL)))
>               return NULL;
> -     memset(report, 0, sizeof(struct hid_report));
>  
>       if (id != 0)
>               report_enum->numbered = 1;
> @@ -97,12 +96,9 @@
>               return NULL;
>       }
>  
> -     if (!(field = kmalloc(sizeof(struct hid_field) + usages * sizeof(struct 
> hid_usage)
> +     if (!(field = kzalloc(sizeof(struct hid_field) + usages * sizeof(struct 
> hid_usage)
>               + values * sizeof(unsigned), GFP_KERNEL))) return NULL;
>  
> -     memset(field, 0, sizeof(struct hid_field) + usages * sizeof(struct 
> hid_usage)
> -             + values * sizeof(unsigned));
> -
>       field->index = report->maxfield++;
>       report->field[field->index] = field;
>       field->usage = (struct hid_usage *)(field + 1);
> @@ -651,17 +647,14 @@
>               hid_parser_reserved
>       };
>  
> -     if (!(device = kmalloc(sizeof(struct hid_device), GFP_KERNEL)))
> +     if (!(device = kzalloc(sizeof(struct hid_device), GFP_KERNEL)))
>               return NULL;
> -     memset(device, 0, sizeof(struct hid_device));
>  
> -     if (!(device->collection = kmalloc(sizeof(struct hid_collection) *
> +     if (!(device->collection = kzalloc(sizeof(struct hid_collection) *
>                                  HID_DEFAULT_NUM_COLLECTIONS, GFP_KERNEL))) {
>               kfree(device);
>               return NULL;
>       }
> -     memset(device->collection, 0, sizeof(struct hid_collection) *
> -             HID_DEFAULT_NUM_COLLECTIONS);
>       device->collection_size = HID_DEFAULT_NUM_COLLECTIONS;
>  
>       for (i = 0; i < HID_REPORT_TYPES; i++)
> @@ -675,13 +668,12 @@
>       memcpy(device->rdesc, start, size);
>       device->rsize = size;
>  
> -     if (!(parser = kmalloc(sizeof(struct hid_parser), GFP_KERNEL))) {
> +     if (!(parser = kzalloc(sizeof(struct hid_parser), GFP_KERNEL))) {
>               kfree(device->rdesc);
>               kfree(device->collection);
>               kfree(device);
>               return NULL;
>       }
> -     memset(parser, 0, sizeof(struct hid_parser));
>       parser->device = device;
>  
>       end = start + size;
> --- linux-2.6.15-vanilla/drivers/usb/input/hid-tmff.c 2006-01-03 
> 04:21:10.000000000 +0100
> +++ linux-2.6.15/drivers/usb/input/hid-tmff.c 2006-01-06 20:33:23.000000000 
> +0100
> @@ -113,11 +113,10 @@
>       struct hid_input *hidinput = list_entry(hid->inputs.next, struct 
> hid_input, list);
>       struct input_dev *input_dev = hidinput->input;
>  
> -     private = kmalloc(sizeof(struct tmff_device), GFP_KERNEL);
> +     private = kzalloc(sizeof(struct tmff_device), GFP_KERNEL);
>       if (!private)
>               return -ENOMEM;
>  
> -     memset(private, 0, sizeof(struct tmff_device));
>       hid->ff_private = private;
>  
>       /* Find the report to use */
> --- linux-2.6.15-vanilla/drivers/usb/input/hid-lgff.c 2006-01-03 
> 04:21:10.000000000 +0100
> +++ linux-2.6.15/drivers/usb/input/hid-lgff.c 2006-01-06 20:34:51.000000000 
> +0100
> @@ -154,10 +154,9 @@
>               return -1;
>       }
>  
> -     private = kmalloc(sizeof(struct lgff_device), GFP_KERNEL);
> +     private = kzalloc(sizeof(struct lgff_device), GFP_KERNEL);
>       if (!private)
>               return -1;
> -     memset(private, 0, sizeof(struct lgff_device));
>       hid->ff_private = private;
>  
>       /* Input init */
> @@ -228,13 +227,12 @@
>       }
>       *ret->field[0] = *report->field[0];
>  
> -     ret->field[0]->value = kmalloc(sizeof(s32[8]), GFP_KERNEL);
> +     ret->field[0]->value = kzalloc(sizeof(s32[8]), GFP_KERNEL);
>       if (!ret->field[0]->value) {
>               kfree(ret->field[0]);
>               kfree(ret);
>               return NULL;
>       }
> -     memset(ret->field[0]->value, 0, sizeof(s32[8]));
>  
>       return ret;
>  }
> --- linux-2.6.15-vanilla/drivers/usb/input/hiddev.c   2006-01-03 
> 04:21:10.000000000 +0100
> +++ linux-2.6.15/drivers/usb/input/hiddev.c   2006-01-06 20:36:18.000000000 
> +0100
> @@ -258,9 +258,8 @@
>       if (i >= HIDDEV_MINORS || !hiddev_table[i])
>               return -ENODEV;
>  
> -     if (!(list = kmalloc(sizeof(struct hiddev_list), GFP_KERNEL)))
> +     if (!(list = kzalloc(sizeof(struct hiddev_list), GFP_KERNEL)))
>               return -ENOMEM;
> -     memset(list, 0, sizeof(struct hiddev_list));
>  
>       list->hiddev = hiddev_table[i];
>       list->next = hiddev_table[i]->list;
> @@ -755,9 +754,8 @@
>       if (i == hid->maxcollection && (hid->quirks & HID_QUIRK_HIDDEV) == 0)
>               return -1;
>  
> -     if (!(hiddev = kmalloc(sizeof(struct hiddev), GFP_KERNEL)))
> +     if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL)))
>               return -1;
> -     memset(hiddev, 0, sizeof(struct hiddev));
>  
>       retval = usb_register_dev(hid->intf, &hiddev_class);
>       if (retval) {
> 
> 

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to