mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] drivers/block: drop unnecesary memset
@ 2009-12-19  7:30 Julia Lawall
  2010-01-04 16:14 ` Miller, Mike (OS Dev)
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2009-12-19  7:30 UTC (permalink / raw)
  To: Mike Miller, iss_storagedev, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

memset of 0 is not needed after kzalloc

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x;
statement S;
@@

x = kzalloc(...);
if (x == NULL) S
... when != x
-memset(x,0,...);// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/block/cciss.c |    1 -
 1 file changed, 1 deletion(-)

diff -u -p a/drivers/block/cciss.c b/drivers/block/cciss.c
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -4379,7 +4379,6 @@ static void cciss_shutdown(struct pci_de
 		return;
 	}
 	/* write all data in the battery backed cache to disk */
-	memset(flush_buf, 0, 4);
 	return_code = sendcmd_withirq(CCISS_CACHE_FLUSH, h->ctlr, flush_buf,
 		4, 0, CTLR_LUNID, TYPE_CMD);
 	kfree(flush_buf);

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

* RE: [PATCH 1/2] drivers/block: drop unnecesary memset
  2009-12-19  7:30 [PATCH 1/2] drivers/block: drop unnecesary memset Julia Lawall
@ 2010-01-04 16:14 ` Miller, Mike (OS Dev)
  0 siblings, 0 replies; 2+ messages in thread
From: Miller, Mike (OS Dev) @ 2010-01-04 16:14 UTC (permalink / raw)
  To: Julia Lawall, ISS StorageDev, linux-kernel, kernel-janitors

 

> -----Original Message-----
> From: Julia Lawall [mailto:julia@diku.dk] 
> Sent: Saturday, December 19, 2009 1:30 AM
> To: Miller, Mike (OS Dev); ISS StorageDev; 
> linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: [PATCH 1/2] drivers/block: drop unnecesary memset
> 
> From: Julia Lawall <julia@diku.dk>
> 
> memset of 0 is not needed after kzalloc
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression x;
> statement S;
> @@
> 
> x = kzalloc(...);
> if (x == NULL) S
> ... when != x
> -memset(x,0,...);// </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>

Acked-by: Mike Miller <mike.miller@hp.com>

> 
> ---
>  drivers/block/cciss.c |    1 -
>  1 file changed, 1 deletion(-)
> 
> diff -u -p a/drivers/block/cciss.c b/drivers/block/cciss.c
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -4379,7 +4379,6 @@ static void cciss_shutdown(struct pci_de
>  		return;
>  	}
>  	/* write all data in the battery backed cache to disk */
> -	memset(flush_buf, 0, 4);
>  	return_code = sendcmd_withirq(CCISS_CACHE_FLUSH, 
> h->ctlr, flush_buf,
>  		4, 0, CTLR_LUNID, TYPE_CMD);
>  	kfree(flush_buf);
> 

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

end of thread, other threads:[~2010-01-04 16:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-19  7:30 [PATCH 1/2] drivers/block: drop unnecesary memset Julia Lawall
2010-01-04 16:14 ` Miller, Mike (OS Dev)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®