diff options
author | Julia Lawall <julia@diku.dk> | 2009-10-17 08:33:22 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-10-30 12:01:27 +0100 |
commit | 4b3be6afa4ab8b3fdce39df68bad71f8b85164de (patch) | |
tree | 9022bd2b563fabc987e31277782076db42946bb7 /sound/pci | |
parent | b71207e9dc044b30d8b5d7f1c2290ba14563f05c (diff) | |
download | kernel_samsung_crespo-4b3be6afa4ab8b3fdce39df68bad71f8b85164de.zip kernel_samsung_crespo-4b3be6afa4ab8b3fdce39df68bad71f8b85164de.tar.gz kernel_samsung_crespo-4b3be6afa4ab8b3fdce39df68bad71f8b85164de.tar.bz2 |
ALSA: sound: Move dereference after NULL test and drop unnecessary NULL tests
In pcm.c, if the NULL test on pcm is needed, then the dereference should be
after the NULL test.
In dummy.c and ali5451.c, the context of the calls to
snd_card_dummy_new_mixer and snd_ali_free_voice show that dummy and pvoice,
respectively cannot be NULL.
A simplified version of the semantic match that detects this problem is as
follows (http://coccinelle.lip6.fr/):
// <smpl>
@match exists@
expression x, E;
identifier fld;
@@
* x->fld
... when != \(x = E\|&x\)
* x == NULL
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/ali5451/ali5451.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index b458d20..aaf4da6 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -973,7 +973,7 @@ static void snd_ali_free_voice(struct snd_ali * codec, void *private_data; snd_ali_printk("free_voice: channel=%d\n",pvoice->number); - if (pvoice == NULL || !pvoice->use) + if (!pvoice->use) return; snd_ali_clear_voices(codec, pvoice->number, pvoice->number); spin_lock_irq(&codec->voice_alloc); |