some kmalloc/memset ->kzalloc (tree wide)
authorYoann Padioleau <padator@wanadoo.fr>
Thu, 19 Jul 2007 08:49:03 +0000 (01:49 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 19 Jul 2007 17:04:50 +0000 (10:04 -0700)
commitdd00cc486ab1c17049a535413d1751ef3482141c
treed90ff69ea06792b9284f2f2665c96624f121b88a
parent3b5ad0797c0e4049001f961a8b58f1d0ce532072
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>
136 files changed:
Documentation/connector/cn_test.c
Documentation/filesystems/configfs/configfs_example.c
arch/alpha/kernel/module.c
arch/arm/mach-iop13xx/pci.c
arch/blackfin/mm/blackfin_sram.c
arch/cris/arch-v32/drivers/pci/dma.c
arch/powerpc/kernel/lparcfg.c
arch/powerpc/kernel/of_platform.c
block/scsi_ioctl.c
drivers/block/sx8.c
drivers/char/amiserial.c
drivers/char/drm/via_dmablit.c
drivers/char/esp.c
drivers/char/hvcs.c
drivers/char/ipmi/ipmi_msghandler.c
drivers/char/pcmcia/synclink_cs.c
drivers/char/rio/rio_linux.c
drivers/char/rio/riocmd.c
drivers/char/rio/riotable.c
drivers/char/rocket.c
drivers/char/synclink.c
drivers/char/synclink_gt.c
drivers/char/synclinkmp.c
drivers/char/watchdog/mpcore_wdt.c
drivers/char/watchdog/pcwd_usb.c
drivers/ide/mips/swarm.c
drivers/infiniband/core/addr.c
drivers/infiniband/hw/cxgb3/iwch_cm.c
drivers/input/serio/ambakmi.c
drivers/input/serio/pcips2.c
drivers/input/serio/sa1111ps2.c
drivers/macintosh/macio_asic.c
drivers/macintosh/smu.c
drivers/macintosh/therm_pm72.c
drivers/macintosh/therm_windtunnel.c
drivers/macintosh/windfarm_lm75_sensor.c
drivers/md/dm-raid1.c
drivers/media/dvb/cinergyT2/cinergyT2.c
drivers/media/video/cpia2/cpia2_core.c
drivers/media/video/msp3400-driver.c
drivers/media/video/planb.c
drivers/media/video/usbvideo/vicam.c
drivers/mfd/mcp-core.c
drivers/mfd/ucb1x00-core.c
drivers/misc/asus-laptop.c
drivers/misc/ibmasm/command.c
drivers/misc/ibmasm/ibmasmfs.c
drivers/misc/ibmasm/module.c
drivers/mmc/card/block.c
drivers/net/b44.c
drivers/net/bsd_comp.c
drivers/net/forcedeth.c
drivers/net/hamradio/dmascc.c
drivers/net/irda/irport.c
drivers/net/irda/irtty-sir.c
drivers/net/iseries_veth.c
drivers/net/lance.c
drivers/net/pcmcia/com20020_cs.c
drivers/net/pcmcia/ibmtr_cs.c
drivers/net/ppp_async.c
drivers/net/ppp_deflate.c
drivers/net/ppp_mppe.c
drivers/net/ppp_synctty.c
drivers/net/shaper.c
drivers/net/wan/c101.c
drivers/net/wan/cosa.c
drivers/net/wan/cycx_main.c
drivers/net/wan/cycx_x25.c
drivers/net/wan/dscc4.c
drivers/net/wan/farsync.c
drivers/net/wan/hostess_sv11.c
drivers/net/wan/n2.c
drivers/net/wan/pc300_drv.c
drivers/net/wan/pc300too.c
drivers/net/wan/pci200syn.c
drivers/net/wan/sdla.c
drivers/net/wan/sealevel.c
drivers/net/wan/wanxl.c
drivers/net/wan/x25_asy.c
drivers/nubus/nubus.c
drivers/parport/parport_cs.c
drivers/parport/parport_serial.c
drivers/pci/pcie/aer/aerdrv.c
drivers/pnp/core.c
drivers/rapidio/rio-scan.c
drivers/s390/char/tape_34xx.c
drivers/s390/net/claw.c
drivers/sbus/char/bbc_i2c.c
drivers/sbus/char/vfc_dev.c
drivers/scsi/3w-9xxx.c
drivers/scsi/NCR53C9x.c
drivers/scsi/NCR_D700.c
drivers/scsi/NCR_Q720.c
drivers/scsi/imm.c
drivers/scsi/ips.c
drivers/scsi/lasi700.c
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/megaraid/megaraid_mbox.c
drivers/scsi/megaraid/megaraid_mm.c
drivers/scsi/megaraid/megaraid_sas.c
drivers/scsi/pcmcia/aha152x_stub.c
drivers/scsi/pcmcia/nsp_cs.c
drivers/scsi/pcmcia/qlogic_stub.c
drivers/scsi/pcmcia/sym53c500_cs.c
drivers/scsi/ppa.c
drivers/scsi/sim710.c
drivers/scsi/tmscsim.c
drivers/serial/amba-pl011.c
drivers/sh/superhyway/superhyway.c
drivers/sn/ioc3.c
drivers/telephony/ixj_pcmcia.c
drivers/usb/gadget/goku_udc.c
drivers/usb/gadget/serial.c
drivers/usb/host/ohci-hcd.c
drivers/usb/host/sl811_cs.c
drivers/video/amba-clcd.c
drivers/video/aty/atyfb_base.c
drivers/video/au1200fb.c
drivers/video/clps711xfb.c
drivers/video/cyber2000fb.c
drivers/video/pvr2fb.c
drivers/video/savage/savagefb_driver.c
drivers/video/valkyriefb.c
drivers/w1/masters/matrox_w1.c
drivers/w1/slaves/w1_ds2433.c
drivers/w1/w1.c
drivers/w1/w1_int.c
fs/dlm/memory.c
fs/ext2/super.c
fs/partitions/check.c
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
net/mac80211/ieee80211_rate.c
net/mac80211/ieee80211_sta.c
net/netfilter/nf_conntrack_standalone.c
net/tipc/name_table.c
sound/core/seq/seq_virmidi.c