Commit 603bf524 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] pcm - NULL check in snd_pcm_suspend*()

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: default avatarTakashi Iwai <tiwai@suse.de>
parent a381a7a6
...@@ -1073,6 +1073,9 @@ int snd_pcm_suspend(struct snd_pcm_substream *substream) ...@@ -1073,6 +1073,9 @@ int snd_pcm_suspend(struct snd_pcm_substream *substream)
int err; int err;
unsigned long flags; unsigned long flags;
if (! substream)
return 0;
snd_pcm_stream_lock_irqsave(substream, flags); snd_pcm_stream_lock_irqsave(substream, flags);
err = snd_pcm_action(&snd_pcm_action_suspend, substream, 0); err = snd_pcm_action(&snd_pcm_action_suspend, substream, 0);
snd_pcm_stream_unlock_irqrestore(substream, flags); snd_pcm_stream_unlock_irqrestore(substream, flags);
...@@ -1091,6 +1094,9 @@ int snd_pcm_suspend_all(struct snd_pcm *pcm) ...@@ -1091,6 +1094,9 @@ int snd_pcm_suspend_all(struct snd_pcm *pcm)
struct snd_pcm_substream *substream; struct snd_pcm_substream *substream;
int stream, err = 0; int stream, err = 0;
if (! pcm)
return 0;
for (stream = 0; stream < 2; stream++) { for (stream = 0; stream < 2; stream++) {
for (substream = pcm->streams[stream].substream; for (substream = pcm->streams[stream].substream;
substream; substream = substream->next) { substream; substream = substream->next) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment