mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/2] drivers/dma: drop unnecesary memset
@ 2009-12-19  7:30 Julia Lawall
  2009-12-23 15:08 ` Sosnowski, Maciej
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2009-12-19  7:30 UTC (permalink / raw)
  To: Dan Williams, Maciej Sosnowski, 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/dma/dw_dmac.c |    2 --
 1 file changed, 2 deletions(-)

diff -u -p a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1270,8 +1270,6 @@ static int __init dw_probe(struct platfo
 		goto err_kfree;
 	}
 
-	memset(dw, 0, sizeof *dw);
-
 	dw->regs = ioremap(io->start, DW_REGLEN);
 	if (!dw->regs) {
 		err = -ENOMEM;

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

* RE: [PATCH 2/2] drivers/dma: drop unnecesary memset
  2009-12-19  7:30 [PATCH 2/2] drivers/dma: drop unnecesary memset Julia Lawall
@ 2009-12-23 15:08 ` Sosnowski, Maciej
  0 siblings, 0 replies; 2+ messages in thread
From: Sosnowski, Maciej @ 2009-12-23 15:08 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Williams, Dan J, linux-kernel, kernel-janitors

Julia Lawall wrote:
> 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/dma/dw_dmac.c |    2 --
>  1 file changed, 2 deletions(-)
> 
> diff -u -p a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> --- a/drivers/dma/dw_dmac.c
> +++ b/drivers/dma/dw_dmac.c
> @@ -1270,8 +1270,6 @@ static int __init dw_probe(struct platfo
>  		goto err_kfree;
>  	}
> 
> -	memset(dw, 0, sizeof *dw);
> -
>  	dw->regs = ioremap(io->start, DW_REGLEN);
>  	if (!dw->regs) {
>  		err = -ENOMEM;

Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>

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

end of thread, other threads:[~2009-12-23 15:08 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 2/2] drivers/dma: drop unnecesary memset Julia Lawall
2009-12-23 15:08 ` Sosnowski, Maciej

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®