浏览代码

[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: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 19 年之前
父节点
当前提交
603bf524aa
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      sound/core/pcm_native.c

+ 6 - 0
sound/core/pcm_native.c

@@ -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) {