Skip to content

Commit

Permalink
[ALSA] pcm - NULL check in snd_pcm_suspend*()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Takashi Iwai authored and Jaroslav Kysela committed Jan 3, 2006
1 parent a381a7a commit 603bf52
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit 603bf52

Please sign in to comment.