From: Jesper Juhl Checking a pointer for NULL before calling kfree() on it is redundant, kfree() deals with NULL pointers just fine. This patch removes such checks from sound/ This patch also makes another, but closely related, change. It avoids casting pointers about to be kfree()'ed. Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton --- sound/core/seq/oss/seq_oss_synth.c | 24 ++++++++---------------- sound/core/seq/seq_dummy.c | 5 +---- sound/core/timer.c | 12 ++++-------- sound/drivers/vx/vx_pcm.c | 12 ++++-------- sound/i2c/tea6330t.c | 3 +-- sound/isa/gus/gus_pcm.c | 3 +-- sound/oss/ad1848.c | 3 +-- sound/oss/ad1889.c | 3 +-- sound/oss/dmasound/dmasound_awacs.c | 20 +++++++------------- sound/oss/emu10k1/midi.c | 6 ++---- sound/oss/emu10k1/passthrough.c | 3 +-- sound/oss/maestro.c | 2 +- sound/oss/mpu401.c | 3 +-- sound/oss/sb_common.c | 4 ++-- sound/pci/ca0106/ca0106_main.c | 6 +----- sound/pci/cs46xx/cs46xx_lib.c | 3 +-- sound/pci/emu10k1/emu10k1x.c | 5 +---- sound/pci/emu10k1/emupcm.c | 4 +--- sound/pci/via82xx.c | 6 ++---- sound/pci/via82xx_modem.c | 6 ++---- sound/pci/ymfpci/ymfpci_main.c | 4 +--- sound/pcmcia/vx/vx_entry.c | 3 +-- sound/synth/emux/emux_effect.c | 6 ++---- sound/usb/usbaudio.c | 12 ++++-------- sound/usb/usbmixer.c | 6 ++---- sound/usb/usx2y/usbusx2yaudio.c | 6 ++---- 26 files changed, 55 insertions(+), 115 deletions(-) diff -puN sound/core/seq/oss/seq_oss_synth.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/core/seq/oss/seq_oss_synth.c --- 25/sound/core/seq/oss/seq_oss_synth.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/core/seq/oss/seq_oss_synth.c 2005-05-11 21:15:55.000000000 -0700 @@ -325,14 +325,10 @@ snd_seq_oss_synth_cleanup(seq_oss_devinf } snd_use_lock_free(&rec->use_lock); } - if (info->sysex) { - kfree(info->sysex); - info->sysex = NULL; - } - if (info->ch) { - kfree(info->ch); - info->ch = NULL; - } + kfree(info->sysex); + info->sysex = NULL; + kfree(info->ch); + info->ch = NULL; } dp->synth_opened = 0; dp->max_synthdev = 0; @@ -418,14 +414,10 @@ snd_seq_oss_synth_reset(seq_oss_devinfo_ dp->file_mode) < 0) { midi_synth_dev.opened--; info->opened = 0; - if (info->sysex) { - kfree(info->sysex); - info->sysex = NULL; - } - if (info->ch) { - kfree(info->ch); - info->ch = NULL; - } + kfree(info->sysex); + info->sysex = NULL; + kfree(info->ch); + info->ch = NULL; } return; } diff -puN sound/core/seq/seq_dummy.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/core/seq/seq_dummy.c --- 25/sound/core/seq/seq_dummy.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/core/seq/seq_dummy.c 2005-05-11 21:15:55.000000000 -0700 @@ -140,10 +140,7 @@ dummy_input(snd_seq_event_t *ev, int dir static void dummy_free(void *private_data) { - snd_seq_dummy_port_t *p; - - p = private_data; - kfree(p); + kfree(private_data); } /* diff -puN sound/core/timer.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/core/timer.c --- 25/sound/core/timer.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/core/timer.c 2005-05-11 21:15:55.000000000 -0700 @@ -1475,14 +1475,10 @@ static int snd_timer_user_tselect(struct if ((err = snd_timer_open(&tu->timeri, str, &tselect.id, current->pid)) < 0) goto __err; - if (tu->queue) { - kfree(tu->queue); - tu->queue = NULL; - } - if (tu->tqueue) { - kfree(tu->tqueue); - tu->tqueue = NULL; - } + kfree(tu->queue); + tu->queue = NULL; + kfree(tu->tqueue); + tu->tqueue = NULL; if (tu->tread) { tu->tqueue = (snd_timer_tread_t *)kmalloc(tu->queue_size * sizeof(snd_timer_tread_t), GFP_KERNEL); if (tu->tqueue == NULL) diff -puN sound/drivers/vx/vx_pcm.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/drivers/vx/vx_pcm.c --- 25/sound/drivers/vx/vx_pcm.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/drivers/vx/vx_pcm.c 2005-05-11 21:15:55.000000000 -0700 @@ -1264,14 +1264,10 @@ static void snd_vx_pcm_free(snd_pcm_t *p { vx_core_t *chip = pcm->private_data; chip->pcm[pcm->device] = NULL; - if (chip->playback_pipes) { - kfree(chip->playback_pipes); - chip->playback_pipes = NULL; - } - if (chip->capture_pipes) { - kfree(chip->capture_pipes); - chip->capture_pipes = NULL; - } + kfree(chip->playback_pipes); + chip->playback_pipes = NULL; + kfree(chip->capture_pipes); + chip->capture_pipes = NULL; } /* diff -puN sound/i2c/tea6330t.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/i2c/tea6330t.c --- 25/sound/i2c/tea6330t.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/i2c/tea6330t.c 2005-05-11 21:15:55.000000000 -0700 @@ -266,8 +266,7 @@ TEA6330T_TREBLE("Tone Control - Treble", static void snd_tea6330_free(snd_i2c_device_t *device) { - tea6330t_t *tea = device->private_data; - kfree(tea); + kfree(device->private_data); } int snd_tea6330t_update_mixer(snd_card_t * card, diff -puN sound/isa/gus/gus_pcm.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/isa/gus/gus_pcm.c --- 25/sound/isa/gus/gus_pcm.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/isa/gus/gus_pcm.c 2005-05-11 21:15:55.000000000 -0700 @@ -656,8 +656,7 @@ static snd_pcm_hardware_t snd_gf1_pcm_ca static void snd_gf1_pcm_playback_free(snd_pcm_runtime_t *runtime) { - gus_pcm_private_t * pcmp = runtime->private_data; - kfree(pcmp); + kfree(runtime->private_data); } static int snd_gf1_pcm_playback_open(snd_pcm_substream_t *substream) diff -puN sound/oss/ad1848.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/oss/ad1848.c --- 25/sound/oss/ad1848.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/oss/ad1848.c 2005-05-11 21:15:55.000000000 -0700 @@ -2178,8 +2178,7 @@ void ad1848_unload(int io_base, int irq, if (devc != NULL) { - if(audio_devs[dev]->portc!=NULL) - kfree(audio_devs[dev]->portc); + kfree(audio_devs[dev]->portc); release_region(devc->base, 4); if (!share_dma) diff -puN sound/oss/ad1889.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/oss/ad1889.c --- 25/sound/oss/ad1889.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/oss/ad1889.c 2005-05-11 21:15:55.000000000 -0700 @@ -277,8 +277,7 @@ static void ad1889_free_dev(ad1889_dev_t for (j = 0; j < AD_MAX_STATES; j++) { dmabuf = &dev->state[j].dmabuf; - if (dmabuf->rawbuf != NULL) - kfree(dmabuf->rawbuf); + kfree(dmabuf->rawbuf); } kfree(dev); diff -puN sound/oss/dmasound/dmasound_awacs.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/oss/dmasound/dmasound_awacs.c --- 25/sound/oss/dmasound/dmasound_awacs.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/oss/dmasound/dmasound_awacs.c 2005-05-11 21:15:55.000000000 -0700 @@ -671,14 +671,10 @@ static void PMacIrqCleanup(void) release_OF_resource(awacs_node, 1); release_OF_resource(awacs_node, 2); - if (awacs_tx_cmd_space) - kfree(awacs_tx_cmd_space); - if (awacs_rx_cmd_space) - kfree(awacs_rx_cmd_space); - if (beep_dbdma_cmd_space) - kfree(beep_dbdma_cmd_space); - if (beep_buf) - kfree(beep_buf); + kfree(awacs_tx_cmd_space); + kfree(awacs_rx_cmd_space); + kfree(beep_dbdma_cmd_space); + kfree(beep_buf); #ifdef CONFIG_PMAC_PBOOK pmu_unregister_sleep_notifier(&awacs_sleep_notifier); #endif @@ -2301,8 +2297,7 @@ if (count <= 0) #endif if ((write_sq.max_count + 1) > number_of_tx_cmd_buffers) { - if (awacs_tx_cmd_space) - kfree(awacs_tx_cmd_space); + kfree(awacs_tx_cmd_space); number_of_tx_cmd_buffers = 0; /* we need nbufs + 1 (for the loop) and we should request + 1 @@ -2360,8 +2355,7 @@ if (count <= 0) #endif if ((read_sq.max_count+1) > number_of_rx_cmd_buffers ) { - if (awacs_rx_cmd_space) - kfree(awacs_rx_cmd_space); + kfree(awacs_rx_cmd_space); number_of_rx_cmd_buffers = 0; /* we need nbufs + 1 (for the loop) and we should request + 1 again @@ -2805,7 +2799,7 @@ __init setup_beep(void) beep_buf = (short *) kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); if (beep_buf == NULL) { printk(KERN_ERR "dmasound_pmac: no memory for beep buffer\n"); - if( beep_dbdma_cmd_space ) kfree(beep_dbdma_cmd_space) ; + kfree(beep_dbdma_cmd_space) ; return -ENOMEM ; } return 0 ; diff -puN sound/oss/emu10k1/midi.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/oss/emu10k1/midi.c --- 25/sound/oss/emu10k1/midi.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/oss/emu10k1/midi.c 2005-05-11 21:15:55.000000000 -0700 @@ -523,10 +523,8 @@ void emu10k1_seq_midi_close(int dev) card = midi_devs[dev]->devc; emu10k1_mpuout_close(card); - if (card->seq_mididev) { - kfree(card->seq_mididev); - card->seq_mididev = NULL; - } + kfree(card->seq_mididev); + card->seq_mididev = NULL; } int emu10k1_seq_midi_out(int dev, unsigned char midi_byte) diff -puN sound/oss/emu10k1/passthrough.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/oss/emu10k1/passthrough.c --- 25/sound/oss/emu10k1/passthrough.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/oss/emu10k1/passthrough.c 2005-05-11 21:15:55.000000000 -0700 @@ -213,8 +213,7 @@ void emu10k1_pt_stop(struct emu10k1_card sblive_writeptr(card, SPCS0 + i, 0, pt->old_spcs[i]); } pt->state = PT_STATE_INACTIVE; - if(pt->buf) - kfree(pt->buf); + kfree(pt->buf); } } diff -puN sound/oss/maestro.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/oss/maestro.c --- 25/sound/oss/maestro.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/oss/maestro.c 2005-05-11 21:15:55.000000000 -0700 @@ -2356,7 +2356,7 @@ ess_read(struct file *file, char __user } rec_return_free: - if(combbuf) kfree(combbuf); + kfree(combbuf); return ret; } diff -puN sound/oss/mpu401.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/oss/mpu401.c --- 25/sound/oss/mpu401.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/oss/mpu401.c 2005-05-11 21:15:55.000000000 -0700 @@ -1240,8 +1240,7 @@ void unload_mpu401(struct address_info * p=mpu401_synth_operations[n]; sound_unload_mididev(n); sound_unload_timerdev(hw_config->slots[2]); - if(p) - kfree(p); + kfree(p); } } diff -puN sound/oss/sb_common.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/oss/sb_common.c --- 25/sound/oss/sb_common.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/oss/sb_common.c 2005-05-11 21:15:55.000000000 -0700 @@ -915,8 +915,8 @@ void sb_dsp_unload(struct address_info * } else release_region(hw_config->io_base, 16); - if(detected_devc) - kfree(detected_devc); + + kfree(detected_devc); } /* diff -puN sound/pci/ca0106/ca0106_main.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/pci/ca0106/ca0106_main.c --- 25/sound/pci/ca0106/ca0106_main.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/pci/ca0106/ca0106_main.c 2005-05-11 21:15:55.000000000 -0700 @@ -259,11 +259,7 @@ static void snd_ca0106_intr_enable(ca010 static void snd_ca0106_pcm_free_substream(snd_pcm_runtime_t *runtime) { - ca0106_pcm_t *epcm = runtime->private_data; - - if (epcm) { - kfree(epcm); - } + kfree(runtime->private_data); } /* open_playback callback */ diff -puN sound/pci/cs46xx/cs46xx_lib.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/pci/cs46xx/cs46xx_lib.c --- 25/sound/pci/cs46xx/cs46xx_lib.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/pci/cs46xx/cs46xx_lib.c 2005-05-11 21:15:55.000000000 -0700 @@ -1295,8 +1295,7 @@ static snd_pcm_hw_constraint_list_t hw_c static void snd_cs46xx_pcm_free_substream(snd_pcm_runtime_t *runtime) { - cs46xx_pcm_t * cpcm = runtime->private_data; - kfree(cpcm); + kfree(runtime->private_data); } static int _cs46xx_playback_open_channel (snd_pcm_substream_t * substream,int pcm_channel_id) diff -puN sound/pci/emu10k1/emu10k1x.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/pci/emu10k1/emu10k1x.c --- 25/sound/pci/emu10k1/emu10k1x.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/pci/emu10k1/emu10k1x.c 2005-05-11 21:15:55.000000000 -0700 @@ -361,10 +361,7 @@ static void snd_emu10k1x_gpio_write(emu1 static void snd_emu10k1x_pcm_free_substream(snd_pcm_runtime_t *runtime) { - emu10k1x_pcm_t *epcm = runtime->private_data; - - if (epcm) - kfree(epcm); + kfree(runtime->private_data); } static void snd_emu10k1x_pcm_interrupt(emu10k1x_t *emu, emu10k1x_voice_t *voice) diff -puN sound/pci/emu10k1/emupcm.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/pci/emu10k1/emupcm.c --- 25/sound/pci/emu10k1/emupcm.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/pci/emu10k1/emupcm.c 2005-05-11 21:15:55.000000000 -0700 @@ -991,9 +991,7 @@ static void snd_emu10k1_pcm_efx_mixer_no static void snd_emu10k1_pcm_free_substream(snd_pcm_runtime_t *runtime) { - emu10k1_pcm_t *epcm = runtime->private_data; - - kfree(epcm); + kfree(runtime->private_data); } static int snd_emu10k1_efx_playback_close(snd_pcm_substream_t * substream) diff -puN sound/pci/via82xx.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/pci/via82xx.c --- 25/sound/pci/via82xx.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/pci/via82xx.c 2005-05-11 21:15:55.000000000 -0700 @@ -491,10 +491,8 @@ static int clean_via_table(viadev_t *dev snd_dma_free_pages(&dev->table); dev->table.area = NULL; } - if (dev->idx_table) { - kfree(dev->idx_table); - dev->idx_table = NULL; - } + kfree(dev->idx_table); + dev->idx_table = NULL; return 0; } diff -puN sound/pci/via82xx_modem.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/pci/via82xx_modem.c --- 25/sound/pci/via82xx_modem.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/pci/via82xx_modem.c 2005-05-11 21:15:55.000000000 -0700 @@ -352,10 +352,8 @@ static int clean_via_table(viadev_t *dev snd_dma_free_pages(&dev->table); dev->table.area = NULL; } - if (dev->idx_table) { - kfree(dev->idx_table); - dev->idx_table = NULL; - } + kfree(dev->idx_table); + dev->idx_table = NULL; return 0; } diff -puN sound/pci/ymfpci/ymfpci_main.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/pci/ymfpci/ymfpci_main.c --- 25/sound/pci/ymfpci/ymfpci_main.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/pci/ymfpci/ymfpci_main.c 2005-05-11 21:15:55.000000000 -0700 @@ -829,9 +829,7 @@ static snd_pcm_hardware_t snd_ymfpci_cap static void snd_ymfpci_pcm_free_substream(snd_pcm_runtime_t *runtime) { - ymfpci_pcm_t *ypcm = runtime->private_data; - - kfree(ypcm); + kfree(runtime->private_data); } static int snd_ymfpci_playback_open_1(snd_pcm_substream_t * substream) diff -puN sound/pcmcia/vx/vx_entry.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/pcmcia/vx/vx_entry.c --- 25/sound/pcmcia/vx/vx_entry.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/pcmcia/vx/vx_entry.c 2005-05-11 21:15:55.000000000 -0700 @@ -68,8 +68,7 @@ static int snd_vxpocket_free(vx_core_t * if (hw) hw->card_list[vxp->index] = NULL; chip->card = NULL; - if (chip->dev) - kfree(chip->dev); + kfree(chip->dev); snd_vx_free_firmware(chip); kfree(chip); diff -puN sound/synth/emux/emux_effect.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/synth/emux/emux_effect.c --- 25/sound/synth/emux/emux_effect.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/synth/emux/emux_effect.c 2005-05-11 21:15:55.000000000 -0700 @@ -291,10 +291,8 @@ snd_emux_create_effect(snd_emux_port_t * void snd_emux_delete_effect(snd_emux_port_t *p) { - if (p->effect) { - kfree(p->effect); - p->effect = NULL; - } + kfree(p->effect); + p->effect = NULL; } void diff -puN sound/usb/usbaudio.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/usb/usbaudio.c --- 25/sound/usb/usbaudio.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/usb/usbaudio.c 2005-05-11 21:15:55.000000000 -0700 @@ -861,10 +861,8 @@ static void release_urb_ctx(snd_urb_ctx_ usb_free_urb(u->urb); u->urb = NULL; } - if (u->buf) { - kfree(u->buf); - u->buf = NULL; - } + kfree(u->buf); + u->buf = NULL; } /* @@ -882,10 +880,8 @@ static void release_substream_urbs(snd_u release_urb_ctx(&subs->dataurb[i]); for (i = 0; i < SYNC_URBS; i++) release_urb_ctx(&subs->syncurb[i]); - if (subs->tmpbuf) { - kfree(subs->tmpbuf); - subs->tmpbuf = NULL; - } + kfree(subs->tmpbuf); + subs->tmpbuf = NULL; subs->nurbs = 0; } diff -puN sound/usb/usbmixer.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/usb/usbmixer.c --- 25/sound/usb/usbmixer.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/usb/usbmixer.c 2005-05-11 21:15:55.000000000 -0700 @@ -623,10 +623,8 @@ static struct usb_feature_control_info a /* private_free callback */ static void usb_mixer_elem_free(snd_kcontrol_t *kctl) { - if (kctl->private_data) { - kfree(kctl->private_data); - kctl->private_data = NULL; - } + kfree(kctl->private_data); + kctl->private_data = NULL; } diff -puN sound/usb/usx2y/usbusx2yaudio.c~remove-redundant-null-checks-before-kfree-in-sound-and sound/usb/usx2y/usbusx2yaudio.c --- 25/sound/usb/usx2y/usbusx2yaudio.c~remove-redundant-null-checks-before-kfree-in-sound-and 2005-05-11 21:15:55.000000000 -0700 +++ 25-akpm/sound/usb/usx2y/usbusx2yaudio.c 2005-05-11 21:15:55.000000000 -0700 @@ -401,10 +401,8 @@ static void usX2Y_urbs_release(snd_usX2Y for (i = 0; i < NRURBS; i++) usX2Y_urb_release(subs->urb + i, subs != subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]); - if (subs->tmpbuf) { - kfree(subs->tmpbuf); - subs->tmpbuf = NULL; - } + kfree(subs->tmpbuf); + subs->tmpbuf = NULL; } /* * initialize a substream's urbs _