]> err.no Git - linux-2.6/commitdiff
[ALSA] pcm - NULL check in snd_pcm_suspend*()
authorTakashi Iwai <tiwai@suse.de>
Thu, 17 Nov 2005 14:59:14 +0000 (15:59 +0100)
committerJaroslav Kysela <perex@suse.cz>
Tue, 3 Jan 2006 11:20:20 +0000 (12:20 +0100)
Modules: PCM Midlevel

Add NULL check in snd_pcm_suspend*() so that the caller doesn't have to do it
by itself.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/pcm_native.c

index 263c01a70fdd413eeebc7dba28f98d4edf14a8fc..7bac1cbe38da4a122478ace0af3855422f805e83 100644 (file)
@@ -1073,6 +1073,9 @@ int snd_pcm_suspend(struct snd_pcm_substream *substream)
        int err;
        unsigned long flags;
 
+       if (! substream)
+               return 0;
+
        snd_pcm_stream_lock_irqsave(substream, flags);
        err = snd_pcm_action(&snd_pcm_action_suspend, substream, 0);
        snd_pcm_stream_unlock_irqrestore(substream, flags);
@@ -1091,6 +1094,9 @@ int snd_pcm_suspend_all(struct snd_pcm *pcm)
        struct snd_pcm_substream *substream;
        int stream, err = 0;
 
+       if (! pcm)
+               return 0;
+
        for (stream = 0; stream < 2; stream++) {
                for (substream = pcm->streams[stream].substream;
                     substream; substream = substream->next) {