* [PATCH] HID: hid-lg4ff: Casting (void *) value returned by kmalloc is useless
@ 2011-11-08 19:14 Thomas Meyer
2011-11-08 19:57 ` simon
2011-11-11 14:10 ` Jiri Kosina
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Meyer @ 2011-11-08 19:14 UTC (permalink / raw)
To: Jiri Kosina, linux-input, linux-kernel
From: Thomas Meyer <thomas@m3y3r.de>
Casting (void *) value returned by kmalloc is useless
as mentioned in Documentation/CodingStyle, Chap 14.
The semantic patch that makes this change is available
in scripts/coccinelle/api/alloc/drop_kmalloc_cast.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
diff -u -p a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
--- a/drivers/hid/hid-lg4ff.c 2011-11-07 19:37:44.816570939 +0100
+++ b/drivers/hid/hid-lg4ff.c 2011-11-08 09:03:29.394045138 +0100
@@ -430,7 +430,7 @@ int lg4ff_init(struct hid_device *hid)
}
/* Add the device to device_list */
- entry = (struct lg4ff_device_entry *)kzalloc(sizeof(struct lg4ff_device_entry), GFP_KERNEL);
+ entry = kzalloc(sizeof(struct lg4ff_device_entry), GFP_KERNEL);
if (!entry) {
hid_err(hid, "Cannot add device, insufficient memory.\n");
return -ENOMEM;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: hid-lg4ff: Casting (void *) value returned by kmalloc is useless
2011-11-08 19:14 [PATCH] HID: hid-lg4ff: Casting (void *) value returned by kmalloc is useless Thomas Meyer
@ 2011-11-08 19:57 ` simon
2011-11-11 14:10 ` Jiri Kosina
1 sibling, 0 replies; 3+ messages in thread
From: simon @ 2011-11-08 19:57 UTC (permalink / raw)
To: Thomas Meyer; +Cc: Jiri Kosina, linux-input, linux-kernel
No objection from me if this is the proper way to do things.
Simon.
> From: Thomas Meyer <thomas@m3y3r.de>
>
> Casting (void *) value returned by kmalloc is useless
> as mentioned in Documentation/CodingStyle, Chap 14.
>
> The semantic patch that makes this change is available
> in scripts/coccinelle/api/alloc/drop_kmalloc_cast.cocci.
>
> More information about semantic patching is available at
> http://coccinelle.lip6.fr/
>
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
>
> diff -u -p a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
> --- a/drivers/hid/hid-lg4ff.c 2011-11-07 19:37:44.816570939 +0100
> +++ b/drivers/hid/hid-lg4ff.c 2011-11-08 09:03:29.394045138 +0100
> @@ -430,7 +430,7 @@ int lg4ff_init(struct hid_device *hid)
> }
>
> /* Add the device to device_list */
> - entry = (struct lg4ff_device_entry *)kzalloc(sizeof(struct
> lg4ff_device_entry), GFP_KERNEL);
> + entry = kzalloc(sizeof(struct lg4ff_device_entry), GFP_KERNEL);
> if (!entry) {
> hid_err(hid, "Cannot add device, insufficient memory.\n");
> return -ENOMEM;
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: hid-lg4ff: Casting (void *) value returned by kmalloc is useless
2011-11-08 19:14 [PATCH] HID: hid-lg4ff: Casting (void *) value returned by kmalloc is useless Thomas Meyer
2011-11-08 19:57 ` simon
@ 2011-11-11 14:10 ` Jiri Kosina
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2011-11-11 14:10 UTC (permalink / raw)
To: Thomas Meyer; +Cc: linux-input, linux-kernel
On Tue, 8 Nov 2011, Thomas Meyer wrote:
> From: Thomas Meyer <thomas@m3y3r.de>
>
> Casting (void *) value returned by kmalloc is useless
> as mentioned in Documentation/CodingStyle, Chap 14.
>
> The semantic patch that makes this change is available
> in scripts/coccinelle/api/alloc/drop_kmalloc_cast.cocci.
>
> More information about semantic patching is available at
> http://coccinelle.lip6.fr/
>
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
>
> diff -u -p a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
> --- a/drivers/hid/hid-lg4ff.c 2011-11-07 19:37:44.816570939 +0100
> +++ b/drivers/hid/hid-lg4ff.c 2011-11-08 09:03:29.394045138 +0100
> @@ -430,7 +430,7 @@ int lg4ff_init(struct hid_device *hid)
> }
>
> /* Add the device to device_list */
> - entry = (struct lg4ff_device_entry *)kzalloc(sizeof(struct lg4ff_device_entry), GFP_KERNEL);
> + entry = kzalloc(sizeof(struct lg4ff_device_entry), GFP_KERNEL);
> if (!entry) {
> hid_err(hid, "Cannot add device, insufficient memory.\n");
> return -ENOMEM;
Applied, thanks Thomas.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-11 14:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-08 19:14 [PATCH] HID: hid-lg4ff: Casting (void *) value returned by kmalloc is useless Thomas Meyer
2011-11-08 19:57 ` simon
2011-11-11 14:10 ` Jiri Kosina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).