From 5cbded585d129d0226cb48ac4202b253c781be26 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Wed, 13 Dec 2006 00:35:56 -0800 Subject: [PATCH] getting rid of all casts of k[cmz]alloc() calls Run this: #!/bin/sh for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do echo "De-casting $f..." perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f done And then go through and reinstate those cases where code is casting pointers to non-pointers. And then drop a few hunks which conflicted with outstanding work. Cc: Russell King , Ian Molton Cc: Mikael Starvik Cc: Yoshinori Sato Cc: Roman Zippel Cc: Geert Uytterhoeven Cc: Ralf Baechle Cc: Paul Mackerras Cc: Kyle McMartin Cc: Benjamin Herrenschmidt Cc: Martin Schwidefsky Cc: "David S. Miller" Cc: Jeff Dike Cc: Greg KH Cc: Jens Axboe Cc: Paul Fulghum Cc: Alan Cox Cc: Karsten Keil Cc: Mauro Carvalho Chehab Cc: Jeff Garzik Cc: James Bottomley Cc: Ian Kent Cc: Steven French Cc: David Woodhouse Cc: Neil Brown Cc: Jaroslav Kysela Cc: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/core/oss/mixer_oss.c | 2 +- sound/oss/ad1848.c | 2 +- sound/oss/cs4232.c | 2 +- sound/oss/emu10k1/audio.c | 6 +++--- sound/oss/emu10k1/cardmi.c | 2 +- sound/oss/emu10k1/cardmo.c | 2 +- sound/oss/emu10k1/midi.c | 10 +++++----- sound/oss/emu10k1/mixer.c | 2 +- sound/oss/hal2.c | 2 +- sound/oss/mpu401.c | 2 +- sound/oss/opl3.c | 2 +- sound/oss/sb_common.c | 2 +- sound/oss/sb_midi.c | 4 ++-- sound/oss/sb_mixer.c | 2 +- sound/oss/v_midi.c | 2 +- sound/oss/waveartist.c | 2 +- 16 files changed, 23 insertions(+), 23 deletions(-) (limited to 'sound') diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index f4c67042e3a..3391f2a9b4d 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -1023,7 +1023,7 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, struct snd_mix } up_read(&mixer->card->controls_rwsem); if (slot.present != 0) { - pslot = (struct slot *)kmalloc(sizeof(slot), GFP_KERNEL); + pslot = kmalloc(sizeof(slot), GFP_KERNEL); if (! pslot) return -ENOMEM; *pslot = slot; diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c index 0ffa9970bf0..7cf9913a47b 100644 --- a/sound/oss/ad1848.c +++ b/sound/oss/ad1848.c @@ -1992,7 +1992,7 @@ int ad1848_init (char *name, struct resource *ports, int irq, int dma_playback, devc->audio_flags |= DMA_DUPLEX; } - portc = (ad1848_port_info *) kmalloc(sizeof(ad1848_port_info), GFP_KERNEL); + portc = kmalloc(sizeof(ad1848_port_info), GFP_KERNEL); if(portc==NULL) { release_region(devc->base, 4); return -1; diff --git a/sound/oss/cs4232.c b/sound/oss/cs4232.c index b6924c7f148..de40e21bf27 100644 --- a/sound/oss/cs4232.c +++ b/sound/oss/cs4232.c @@ -408,7 +408,7 @@ static int __init cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_ { struct address_info *isapnpcfg; - isapnpcfg=(struct address_info*)kmalloc(sizeof(*isapnpcfg),GFP_KERNEL); + isapnpcfg = kmalloc(sizeof(*isapnpcfg),GFP_KERNEL); if (!isapnpcfg) return -ENOMEM; diff --git a/sound/oss/emu10k1/audio.c b/sound/oss/emu10k1/audio.c index 49f902f35c2..efcf589d708 100644 --- a/sound/oss/emu10k1/audio.c +++ b/sound/oss/emu10k1/audio.c @@ -1139,7 +1139,7 @@ static int emu10k1_audio_open(struct inode *inode, struct file *file) match: - wave_dev = (struct emu10k1_wavedevice *) kmalloc(sizeof(struct emu10k1_wavedevice), GFP_KERNEL); + wave_dev = kmalloc(sizeof(struct emu10k1_wavedevice), GFP_KERNEL); if (wave_dev == NULL) { ERROR(); @@ -1155,7 +1155,7 @@ match: /* Recording */ struct wiinst *wiinst; - if ((wiinst = (struct wiinst *) kmalloc(sizeof(struct wiinst), GFP_KERNEL)) == NULL) { + if ((wiinst = kmalloc(sizeof(struct wiinst), GFP_KERNEL)) == NULL) { ERROR(); kfree(wave_dev); return -ENOMEM; @@ -1211,7 +1211,7 @@ match: struct woinst *woinst; int i; - if ((woinst = (struct woinst *) kmalloc(sizeof(struct woinst), GFP_KERNEL)) == NULL) { + if ((woinst = kmalloc(sizeof(struct woinst), GFP_KERNEL)) == NULL) { ERROR(); kfree(wave_dev); return -ENOMEM; diff --git a/sound/oss/emu10k1/cardmi.c b/sound/oss/emu10k1/cardmi.c index 0545814cc67..57674f8c8a2 100644 --- a/sound/oss/emu10k1/cardmi.c +++ b/sound/oss/emu10k1/cardmi.c @@ -157,7 +157,7 @@ int emu10k1_mpuin_add_buffer(struct emu10k1_mpuin *card_mpuin, struct midi_hdr * midihdr->flags |= MIDIBUF_INQUEUE; /* set */ midihdr->flags &= ~MIDIBUF_DONE; /* clear */ - if ((midiq = (struct midi_queue *) kmalloc(sizeof(struct midi_queue), GFP_ATOMIC)) == NULL) { + if ((midiq = kmalloc(sizeof(struct midi_queue), GFP_ATOMIC)) == NULL) { /* Message lost */ return -1; } diff --git a/sound/oss/emu10k1/cardmo.c b/sound/oss/emu10k1/cardmo.c index 5938d31f9e2..a8cc75db3e4 100644 --- a/sound/oss/emu10k1/cardmo.c +++ b/sound/oss/emu10k1/cardmo.c @@ -117,7 +117,7 @@ int emu10k1_mpuout_add_buffer(struct emu10k1_card *card, struct midi_hdr *midihd midihdr->flags |= MIDIBUF_INQUEUE; midihdr->flags &= ~MIDIBUF_DONE; - if ((midiq = (struct midi_queue *) kmalloc(sizeof(struct midi_queue), GFP_KERNEL)) == NULL) { + if ((midiq = kmalloc(sizeof(struct midi_queue), GFP_KERNEL)) == NULL) { /* Message lost */ return -1; } diff --git a/sound/oss/emu10k1/midi.c b/sound/oss/emu10k1/midi.c index 8ac77df8639..cca3dad2bdf 100644 --- a/sound/oss/emu10k1/midi.c +++ b/sound/oss/emu10k1/midi.c @@ -58,7 +58,7 @@ static int midiin_add_buffer(struct emu10k1_mididevice *midi_dev, struct midi_hd { struct midi_hdr *midihdr; - if ((midihdr = (struct midi_hdr *) kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) { + if ((midihdr = kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) { ERROR(); return -EINVAL; } @@ -128,7 +128,7 @@ match: mutex_lock(&card->open_sem); } - if ((midi_dev = (struct emu10k1_mididevice *) kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL) + if ((midi_dev = kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL) return -EINVAL; midi_dev->card = card; @@ -328,7 +328,7 @@ static ssize_t emu10k1_midi_write(struct file *file, const char __user *buffer, if (!access_ok(VERIFY_READ, buffer, count)) return -EFAULT; - if ((midihdr = (struct midi_hdr *) kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) + if ((midihdr = kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) return -EINVAL; midihdr->bufferlength = count; @@ -490,7 +490,7 @@ int emu10k1_seq_midi_open(int dev, int mode, DPF(2, "emu10k1_seq_midi_open()\n"); - if ((midi_dev = (struct emu10k1_mididevice *) kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL) + if ((midi_dev = kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL) return -EINVAL; midi_dev->card = card; @@ -540,7 +540,7 @@ int emu10k1_seq_midi_out(int dev, unsigned char midi_byte) card = midi_devs[dev]->devc; - if ((midihdr = (struct midi_hdr *) kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) + if ((midihdr = kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) return -EINVAL; midihdr->bufferlength = 1; diff --git a/sound/oss/emu10k1/mixer.c b/sound/oss/emu10k1/mixer.c index cbcaaa34189..6419796c2ed 100644 --- a/sound/oss/emu10k1/mixer.c +++ b/sound/oss/emu10k1/mixer.c @@ -194,7 +194,7 @@ static int emu10k1_private_mixer(struct emu10k1_card *card, unsigned int cmd, un case SOUND_MIXER_PRIVATE3: - ctl = (struct mixer_private_ioctl *) kmalloc(sizeof(struct mixer_private_ioctl), GFP_KERNEL); + ctl = kmalloc(sizeof(struct mixer_private_ioctl), GFP_KERNEL); if (ctl == NULL) return -ENOMEM; diff --git a/sound/oss/hal2.c b/sound/oss/hal2.c index 784bdd70705..d18286ccc14 100644 --- a/sound/oss/hal2.c +++ b/sound/oss/hal2.c @@ -1435,7 +1435,7 @@ static int hal2_init_card(struct hal2_card **phal2, struct hpc3_regs *hpc3) int ret = 0; struct hal2_card *hal2; - hal2 = (struct hal2_card *) kmalloc(sizeof(struct hal2_card), GFP_KERNEL); + hal2 = kmalloc(sizeof(struct hal2_card), GFP_KERNEL); if (!hal2) return -ENOMEM; memset(hal2, 0, sizeof(struct hal2_card)); diff --git a/sound/oss/mpu401.c b/sound/oss/mpu401.c index e9622054197..2796c0ef985 100644 --- a/sound/oss/mpu401.c +++ b/sound/oss/mpu401.c @@ -1023,7 +1023,7 @@ int attach_mpu401(struct address_info *hw_config, struct module *owner) devc->capabilities |= MPU_CAP_INTLG; /* Supports intelligent mode */ - mpu401_synth_operations[m] = (struct synth_operations *)kmalloc(sizeof(struct synth_operations), GFP_KERNEL); + mpu401_synth_operations[m] = kmalloc(sizeof(struct synth_operations), GFP_KERNEL); if (mpu401_synth_operations[m] == NULL) { diff --git a/sound/oss/opl3.c b/sound/oss/opl3.c index 4799bc77f98..2e8cfa5481f 100644 --- a/sound/oss/opl3.c +++ b/sound/oss/opl3.c @@ -166,7 +166,7 @@ int opl3_detect(int ioaddr, int *osp) return 0; } - devc = (struct opl_devinfo *)kmalloc(sizeof(*devc), GFP_KERNEL); + devc = kmalloc(sizeof(*devc), GFP_KERNEL); if (devc == NULL) { diff --git a/sound/oss/sb_common.c b/sound/oss/sb_common.c index 440537c7260..07cbacf6382 100644 --- a/sound/oss/sb_common.c +++ b/sound/oss/sb_common.c @@ -625,7 +625,7 @@ int sb_dsp_detect(struct address_info *hw_config, int pci, int pciio, struct sb_ */ - detected_devc = (sb_devc *)kmalloc(sizeof(sb_devc), GFP_KERNEL); + detected_devc = kmalloc(sizeof(sb_devc), GFP_KERNEL); if (detected_devc == NULL) { printk(KERN_ERR "sb: Can't allocate memory for device information\n"); diff --git a/sound/oss/sb_midi.c b/sound/oss/sb_midi.c index 2e3bc045cab..8b796704e11 100644 --- a/sound/oss/sb_midi.c +++ b/sound/oss/sb_midi.c @@ -173,7 +173,7 @@ void sb_dsp_midi_init(sb_devc * devc, struct module *owner) return; } std_midi_synth.midi_dev = devc->my_mididev = dev; - midi_devs[dev] = (struct midi_operations *)kmalloc(sizeof(struct midi_operations), GFP_KERNEL); + midi_devs[dev] = kmalloc(sizeof(struct midi_operations), GFP_KERNEL); if (midi_devs[dev] == NULL) { printk(KERN_WARNING "Sound Blaster: failed to allocate MIDI memory.\n"); @@ -189,7 +189,7 @@ void sb_dsp_midi_init(sb_devc * devc, struct module *owner) midi_devs[dev]->devc = devc; - midi_devs[dev]->converter = (struct synth_operations *)kmalloc(sizeof(struct synth_operations), GFP_KERNEL); + midi_devs[dev]->converter = kmalloc(sizeof(struct synth_operations), GFP_KERNEL); if (midi_devs[dev]->converter == NULL) { printk(KERN_WARNING "Sound Blaster: failed to allocate MIDI memory.\n"); diff --git a/sound/oss/sb_mixer.c b/sound/oss/sb_mixer.c index 238e2cf44b0..fad1a4f25ad 100644 --- a/sound/oss/sb_mixer.c +++ b/sound/oss/sb_mixer.c @@ -734,7 +734,7 @@ int sb_mixer_init(sb_devc * devc, struct module *owner) if (m == -1) return 0; - mixer_devs[m] = (struct mixer_operations *)kmalloc(sizeof(struct mixer_operations), GFP_KERNEL); + mixer_devs[m] = kmalloc(sizeof(struct mixer_operations), GFP_KERNEL); if (mixer_devs[m] == NULL) { printk(KERN_ERR "sb_mixer: Can't allocate memory\n"); diff --git a/sound/oss/v_midi.c b/sound/oss/v_midi.c index d952b2264da..103940fd5b4 100644 --- a/sound/oss/v_midi.c +++ b/sound/oss/v_midi.c @@ -183,7 +183,7 @@ static void __init attach_v_midi (struct address_info *hw_config) return; } - m=(struct vmidi_memory *)kmalloc(sizeof(struct vmidi_memory), GFP_KERNEL); + m = kmalloc(sizeof(struct vmidi_memory), GFP_KERNEL); if (m == NULL) { printk(KERN_WARNING "Loopback MIDI: Failed to allocate memory\n"); diff --git a/sound/oss/waveartist.c b/sound/oss/waveartist.c index c5bf363d32c..26a7c6af95b 100644 --- a/sound/oss/waveartist.c +++ b/sound/oss/waveartist.c @@ -1267,7 +1267,7 @@ static int __init waveartist_init(wavnc_info *devc) conf_printf2(dev_name, devc->hw.io_base, devc->hw.irq, devc->hw.dma, devc->hw.dma2); - portc = (wavnc_port_info *)kmalloc(sizeof(wavnc_port_info), GFP_KERNEL); + portc = kmalloc(sizeof(wavnc_port_info), GFP_KERNEL); if (portc == NULL) goto nomem; -- cgit v1.2.3