All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/usb: Use kzalloc
@ 2011-08-02 16:09 ` Thomas Meyer
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Meyer @ 2011-08-02 16:09 UTC (permalink / raw)
  To: linux-kernel, kernel-janitors

--- a/drivers/net/usb/cdc_ncm.c 2011-07-26 00:46:08.126846923 +0200
+++ b/drivers/net/usb/cdc_ncm.c 2011-08-01 20:20:43.396390040 +0200
@@ -479,12 +479,10 @@ static int cdc_ncm_bind(struct usbnet *d
 	int temp;
 	u8 iface_no;
 
-	ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
+	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
 	if (ctx == NULL)
 		return -ENODEV;
 
-	memset(ctx, 0, sizeof(*ctx));
-
 	init_timer(&ctx->tx_timer);
 	spin_lock_init(&ctx->mtx);
 	ctx->netdev = dev->net;



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] net/usb: Use kzalloc
@ 2011-08-02 16:09 ` Thomas Meyer
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Meyer @ 2011-08-02 16:09 UTC (permalink / raw)
  To: linux-kernel, kernel-janitors

--- a/drivers/net/usb/cdc_ncm.c 2011-07-26 00:46:08.126846923 +0200
+++ b/drivers/net/usb/cdc_ncm.c 2011-08-01 20:20:43.396390040 +0200
@@ -479,12 +479,10 @@ static int cdc_ncm_bind(struct usbnet *d
 	int temp;
 	u8 iface_no;
 
-	ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
+	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
 	if (ctx = NULL)
 		return -ENODEV;
 
-	memset(ctx, 0, sizeof(*ctx));
-
 	init_timer(&ctx->tx_timer);
 	spin_lock_init(&ctx->mtx);
 	ctx->netdev = dev->net;



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] net/usb: Use kzalloc
  2011-08-02 16:09 ` Thomas Meyer
@ 2011-08-03  9:02   ` Tobias Klauser
  -1 siblings, 0 replies; 8+ messages in thread
From: Tobias Klauser @ 2011-08-03  9:02 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: linux-kernel, kernel-janitors

Please add a Signed-off-by line as mentioned in
Documentation/SubmittingPatches.

Also you should Cc: the proper maintainer and list (in this case
netdev). You can use scripts/get_maintainers.pl to get this information

Cheers
Tobias

On 2011-08-02 at 18:09:28 +0200, Thomas Meyer <thomas@m3y3r.de> wrote:
> --- a/drivers/net/usb/cdc_ncm.c 2011-07-26 00:46:08.126846923 +0200
> +++ b/drivers/net/usb/cdc_ncm.c 2011-08-01 20:20:43.396390040 +0200
> @@ -479,12 +479,10 @@ static int cdc_ncm_bind(struct usbnet *d
>  	int temp;
>  	u8 iface_no;
>  
> -	ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
> +	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
>  	if (ctx == NULL)
>  		return -ENODEV;
>  
> -	memset(ctx, 0, sizeof(*ctx));
> -
>  	init_timer(&ctx->tx_timer);
>  	spin_lock_init(&ctx->mtx);
>  	ctx->netdev = dev->net;
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] net/usb: Use kzalloc
@ 2011-08-03  9:02   ` Tobias Klauser
  0 siblings, 0 replies; 8+ messages in thread
From: Tobias Klauser @ 2011-08-03  9:02 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: linux-kernel, kernel-janitors

Please add a Signed-off-by line as mentioned in
Documentation/SubmittingPatches.

Also you should Cc: the proper maintainer and list (in this case
netdev). You can use scripts/get_maintainers.pl to get this information

Cheers
Tobias

On 2011-08-02 at 18:09:28 +0200, Thomas Meyer <thomas@m3y3r.de> wrote:
> --- a/drivers/net/usb/cdc_ncm.c 2011-07-26 00:46:08.126846923 +0200
> +++ b/drivers/net/usb/cdc_ncm.c 2011-08-01 20:20:43.396390040 +0200
> @@ -479,12 +479,10 @@ static int cdc_ncm_bind(struct usbnet *d
>  	int temp;
>  	u8 iface_no;
>  
> -	ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
> +	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
>  	if (ctx = NULL)
>  		return -ENODEV;
>  
> -	memset(ctx, 0, sizeof(*ctx));
> -
>  	init_timer(&ctx->tx_timer);
>  	spin_lock_init(&ctx->mtx);
>  	ctx->netdev = dev->net;
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] net/usb: Use kzalloc
  2011-08-03  9:02   ` Tobias Klauser
@ 2011-08-04 20:31     ` Julie Sullivan
  -1 siblings, 0 replies; 8+ messages in thread
From: Julie Sullivan @ 2011-08-04 20:31 UTC (permalink / raw)
  To: Tobias Klauser; +Cc: Thomas Meyer, linux-kernel, kernel-janitors

> On 2011-08-02 at 18:09:28 +0200, Thomas Meyer <thomas@m3y3r.de> wrote:
>> --- a/drivers/net/usb/cdc_ncm.c 2011-07-26 00:46:08.126846923 +0200
>> +++ b/drivers/net/usb/cdc_ncm.c 2011-08-01 20:20:43.396390040 +0200
>> @@ -479,12 +479,10 @@ static int cdc_ncm_bind(struct usbnet *d
>>       int temp;
>>       u8 iface_no;
>>
>> -     ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
>> +     ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
>>       if (ctx == NULL)
>>               return -ENODEV;
>>
>> -     memset(ctx, 0, sizeof(*ctx));
>> -
>>       init_timer(&ctx->tx_timer);
>>       spin_lock_init(&ctx->mtx);
>>       ctx->netdev = dev->net;
>>
>>
>> --

I think we could do with a log message before the SOB too (like you
did in your 'Use resource_size()' patch? :-)
The subject line is rather terse on its own.

Cheers
Julie

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] net/usb: Use kzalloc
@ 2011-08-04 20:31     ` Julie Sullivan
  0 siblings, 0 replies; 8+ messages in thread
From: Julie Sullivan @ 2011-08-04 20:31 UTC (permalink / raw)
  To: Tobias Klauser; +Cc: Thomas Meyer, linux-kernel, kernel-janitors

> On 2011-08-02 at 18:09:28 +0200, Thomas Meyer <thomas@m3y3r.de> wrote:
>> --- a/drivers/net/usb/cdc_ncm.c 2011-07-26 00:46:08.126846923 +0200
>> +++ b/drivers/net/usb/cdc_ncm.c 2011-08-01 20:20:43.396390040 +0200
>> @@ -479,12 +479,10 @@ static int cdc_ncm_bind(struct usbnet *d
>>       int temp;
>>       u8 iface_no;
>>
>> -     ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
>> +     ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
>>       if (ctx = NULL)
>>               return -ENODEV;
>>
>> -     memset(ctx, 0, sizeof(*ctx));
>> -
>>       init_timer(&ctx->tx_timer);
>>       spin_lock_init(&ctx->mtx);
>>       ctx->netdev = dev->net;
>>
>>
>> --

I think we could do with a log message before the SOB too (like you
did in your 'Use resource_size()' patch? :-)
The subject line is rather terse on its own.

Cheers
Julie
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" 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] 8+ messages in thread

* [PATCH] net/usb: Use kzalloc
  2011-08-04 20:31     ` Julie Sullivan
@ 2011-08-04 20:51       ` Thomas Meyer
  -1 siblings, 0 replies; 8+ messages in thread
From: Thomas Meyer @ 2011-08-04 20:51 UTC (permalink / raw)
  To: Julie Sullivan; +Cc: Tobias Klauser, linux-kernel, kernel-janitors

From: Thomas Meyer <thomas@m3y3r.de>

 Use kzalloc rather than kmalloc followed by memset with 0

 This considers some simple cases that are common and easy to validate
 Note in particular that there are no ...s in the rule, so all of the
 matched code has to be contiguous

 The semantic patch that makes this output is available
 in scripts/coccinelle/api/alloc/kzalloc-simple.cocci.

 More information about semantic patching is available at
 http://coccinelle.lip6.fr/

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

Am Donnerstag, den 04.08.2011, 21:31 +0100 schrieb Julie Sullivan:
> I think we could do with a log message before the SOB too (like you
> did in your 'Use resource_size()' patch? :-)
> 
yes, sure! sorry! I promise to improve.

here you go:

diff -u -p a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
--- a/drivers/net/usb/cdc_ncm.c 2011-07-26 00:46:08.126846923 +0200
+++ b/drivers/net/usb/cdc_ncm.c 2011-08-01 20:20:43.396390040 +0200
@@ -479,12 +479,10 @@ static int cdc_ncm_bind(struct usbnet *d
 	int temp;
 	u8 iface_no;
 
-	ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
+	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
 	if (ctx == NULL)
 		return -ENODEV;
 
-	memset(ctx, 0, sizeof(*ctx));
-
 	init_timer(&ctx->tx_timer);
 	spin_lock_init(&ctx->mtx);
 	ctx->netdev = dev->net;




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] net/usb: Use kzalloc
@ 2011-08-04 20:51       ` Thomas Meyer
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Meyer @ 2011-08-04 20:51 UTC (permalink / raw)
  To: Julie Sullivan; +Cc: Tobias Klauser, linux-kernel, kernel-janitors

From: Thomas Meyer <thomas@m3y3r.de>

 Use kzalloc rather than kmalloc followed by memset with 0

 This considers some simple cases that are common and easy to validate
 Note in particular that there are no ...s in the rule, so all of the
 matched code has to be contiguous

 The semantic patch that makes this output is available
 in scripts/coccinelle/api/alloc/kzalloc-simple.cocci.

 More information about semantic patching is available at
 http://coccinelle.lip6.fr/

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

Am Donnerstag, den 04.08.2011, 21:31 +0100 schrieb Julie Sullivan:
> I think we could do with a log message before the SOB too (like you
> did in your 'Use resource_size()' patch? :-)
> 
yes, sure! sorry! I promise to improve.

here you go:

diff -u -p a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
--- a/drivers/net/usb/cdc_ncm.c 2011-07-26 00:46:08.126846923 +0200
+++ b/drivers/net/usb/cdc_ncm.c 2011-08-01 20:20:43.396390040 +0200
@@ -479,12 +479,10 @@ static int cdc_ncm_bind(struct usbnet *d
 	int temp;
 	u8 iface_no;
 
-	ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
+	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
 	if (ctx = NULL)
 		return -ENODEV;
 
-	memset(ctx, 0, sizeof(*ctx));
-
 	init_timer(&ctx->tx_timer);
 	spin_lock_init(&ctx->mtx);
 	ctx->netdev = dev->net;




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-08-04 20:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-02 16:09 [PATCH] net/usb: Use kzalloc Thomas Meyer
2011-08-02 16:09 ` Thomas Meyer
2011-08-03  9:02 ` Tobias Klauser
2011-08-03  9:02   ` Tobias Klauser
2011-08-04 20:31   ` Julie Sullivan
2011-08-04 20:31     ` Julie Sullivan
2011-08-04 20:51     ` Thomas Meyer
2011-08-04 20:51       ` Thomas Meyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.