aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/rio
diff options
context:
space:
mode:
authorYoann Padioleau <padator@wanadoo.fr>2007-07-19 04:49:03 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:50 -0400
commitdd00cc486ab1c17049a535413d1751ef3482141c (patch)
treed90ff69ea06792b9284f2f2665c96624f121b88a /drivers/char/rio
parent3b5ad0797c0e4049001f961a8b58f1d0ce532072 (diff)
some kmalloc/memset ->kzalloc (tree wide)
Transform some calls to kmalloc/memset to a single kzalloc (or kcalloc). Here is a short excerpt of the semantic patch performing this transformation: @@ type T2; expression x; identifier f,fld; expression E; expression E1,E2; expression e1,e2,e3,y; statement S; @@ x = - kmalloc + kzalloc (E1,E2) ... when != \(x->fld=E;\|y=f(...,x,...);\|f(...,x,...);\|x=E;\|while(...) S\|for(e1;e2;e3) S\) - memset((T2)x,0,E1); @@ expression E1,E2,E3; @@ - kzalloc(E1 * E2,E3) + kcalloc(E1,E2,E3) [akpm@linux-foundation.org: get kcalloc args the right way around] Signed-off-by: Yoann Padioleau <padator@wanadoo.fr> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Acked-by: Russell King <rmk@arm.linux.org.uk> Cc: Bryan Wu <bryan.wu@analog.com> Acked-by: Jiri Slaby <jirislaby@gmail.com> Cc: Dave Airlie <airlied@linux.ie> Acked-by: Roland Dreier <rolandd@cisco.com> Cc: Jiri Kosina <jkosina@suse.cz> Acked-by: Dmitry Torokhov <dtor@mail.ru> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org> Acked-by: Pierre Ossman <drzeus-list@drzeus.cx> Cc: Jeff Garzik <jeff@garzik.org> Cc: "David S. Miller" <davem@davemloft.net> Acked-by: Greg KH <greg@kroah.com> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/rio')
-rw-r--r--drivers/char/rio/rio_linux.c4
-rw-r--r--drivers/char/rio/riocmd.c4
-rw-r--r--drivers/char/rio/riotable.c3
3 files changed, 3 insertions, 8 deletions
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index 294e9cb0c449..0ce96670f979 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -803,9 +803,7 @@ static void *ckmalloc(int size)
803{ 803{
804 void *p; 804 void *p;
805 805
806 p = kmalloc(size, GFP_KERNEL); 806 p = kzalloc(size, GFP_KERNEL);
807 if (p)
808 memset(p, 0, size);
809 return p; 807 return p;
810} 808}
811 809
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c
index 8cc60b693460..7321d002c34f 100644
--- a/drivers/char/rio/riocmd.c
+++ b/drivers/char/rio/riocmd.c
@@ -556,9 +556,7 @@ struct CmdBlk *RIOGetCmdBlk(void)
556{ 556{
557 struct CmdBlk *CmdBlkP; 557 struct CmdBlk *CmdBlkP;
558 558
559 CmdBlkP = kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC); 559 CmdBlkP = kzalloc(sizeof(struct CmdBlk), GFP_ATOMIC);
560 if (CmdBlkP)
561 memset(CmdBlkP, 0, sizeof(struct CmdBlk));
562 return CmdBlkP; 560 return CmdBlkP;
563} 561}
564 562
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c
index 7e988357326e..991119c9f473 100644
--- a/drivers/char/rio/riotable.c
+++ b/drivers/char/rio/riotable.c
@@ -863,8 +863,7 @@ int RIOReMapPorts(struct rio_info *p, struct Host *HostP, struct Map *HostMapP)
863 if (PortP->TxRingBuffer) 863 if (PortP->TxRingBuffer)
864 memset(PortP->TxRingBuffer, 0, p->RIOBufferSize); 864 memset(PortP->TxRingBuffer, 0, p->RIOBufferSize);
865 else if (p->RIOBufferSize) { 865 else if (p->RIOBufferSize) {
866 PortP->TxRingBuffer = kmalloc(p->RIOBufferSize, GFP_KERNEL); 866 PortP->TxRingBuffer = kzalloc(p->RIOBufferSize, GFP_KERNEL);
867 memset(PortP->TxRingBuffer, 0, p->RIOBufferSize);
868 } 867 }
869 PortP->TxBufferOut = 0; 868 PortP->TxBufferOut = 0;
870 PortP->TxBufferIn = 0; 869 PortP->TxBufferIn = 0;