2007-01-06 13:19:15

by Ahmed S. Darwish

[permalink] [raw]
Subject: [PATCH 2.6.20-rc3] HID-Core: Tiny patch to remove a kmalloc cast

I'm really shy from the size of the patch :).

Signed-off-by: Ahmed Darwish <[email protected]>

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 18c2b3c..2fcfdbb 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -656,7 +656,7 @@ struct hid_device *hid_parse_report(__u8 *start, unsigned size)
for (i = 0; i < HID_REPORT_TYPES; i++)
INIT_LIST_HEAD(&device->report_enum[i].report_list);

- if (!(device->rdesc = (__u8 *)kmalloc(size, GFP_KERNEL))) {
+ if (!(device->rdesc = kmalloc(size, GFP_KERNEL))) {
kfree(device->collection);
kfree(device);
return NULL;


--
Ahmed S. Darwish
http://darwish-07.blogspot.com


2007-01-06 16:18:18

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH 2.6.20-rc3] HID-Core: Tiny patch to remove a kmalloc cast

On Sat, 6 Jan 2007, Ahmed S. Darwish wrote:

> Signed-off-by: Ahmed Darwish <[email protected]>
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 18c2b3c..2fcfdbb 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -656,7 +656,7 @@ struct hid_device *hid_parse_report(__u8 *start, unsigned size)
> for (i = 0; i < HID_REPORT_TYPES; i++)
> INIT_LIST_HEAD(&device->report_enum[i].report_list);
>
> - if (!(device->rdesc = (__u8 *)kmalloc(size, GFP_KERNEL))) {
> + if (!(device->rdesc = kmalloc(size, GFP_KERNEL))) {
> kfree(device->collection);
> kfree(device);
> return NULL;

Queued for upstream, thanks.

--
Jiri Kosina
SUSE Labs