Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 22024
b: refs/heads/master
c: bbdb7da
h: refs/heads/master
v: v3
  • Loading branch information
Oliver Neukum authored and Greg Kroah-Hartman committed Mar 20, 2006
1 parent 1c84ec5 commit 750461f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 24 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: 887c2560b6ceb5fe7ac24704e85af507c6d960e5
refs/heads/master: bbdb7dafb5b5a3c0197cbabd5055d8e9c093e3ea
18 changes: 5 additions & 13 deletions trunk/drivers/usb/input/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ static struct hid_report *hid_register_report(struct hid_device *device, unsigne
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;
Expand Down Expand Up @@ -97,12 +96,9 @@ static struct hid_field *hid_register_field(struct hid_report *report, unsigned
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);
Expand Down Expand Up @@ -651,17 +647,14 @@ static struct hid_device *hid_parse_report(__u8 *start, unsigned size)
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++)
Expand All @@ -675,13 +668,12 @@ static struct hid_device *hid_parse_report(__u8 *start, unsigned size)
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;
Expand Down
6 changes: 2 additions & 4 deletions trunk/drivers/usb/input/hid-lgff.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,9 @@ int hid_lgff_init(struct hid_device* hid)
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 */
Expand Down Expand Up @@ -228,13 +227,12 @@ static struct hid_report* hid_lgff_duplicate_report(struct hid_report* report)
}
*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;
}
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/usb/input/hid-tmff.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,10 @@ int hid_tmff_init(struct hid_device *hid)
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 */
Expand Down
6 changes: 2 additions & 4 deletions trunk/drivers/usb/input/hiddev.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,8 @@ static int hiddev_open(struct inode * inode, struct file * file) {
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;
Expand Down Expand Up @@ -754,9 +753,8 @@ int hiddev_connect(struct hid_device *hid)
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) {
Expand Down

0 comments on commit 750461f

Please sign in to comment.