aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXi Wang <xi.wang@gmail.com>2012-11-13 17:12:12 -0500
committerTakashi Iwai <tiwai@suse.de>2012-11-14 02:03:31 -0500
commit701ef3205eb33bce4ba97b96f6f04a5ae29cd7b8 (patch)
treebc6c90b94fea09e46f402070f2718141ed23734e
parent9af4e7fedab490fec6e831912859d6be92e9140d (diff)
ALSA: core: fix NULL checking in snd_pcm_plug_slave_size()
The dereference snd_pcm_plug_stream(plug) should come after the NULL check snd_BUG_ON(!plug). Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/core/oss/pcm_plugin.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c
index f0d7b1566a10..727ac44d39f4 100644
--- a/sound/core/oss/pcm_plugin.c
+++ b/sound/core/oss/pcm_plugin.c
@@ -231,13 +231,14 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc
231{ 231{
232 struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next; 232 struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next;
233 snd_pcm_sframes_t frames; 233 snd_pcm_sframes_t frames;
234 int stream = snd_pcm_plug_stream(plug); 234 int stream;
235 235
236 if (snd_BUG_ON(!plug)) 236 if (snd_BUG_ON(!plug))
237 return -ENXIO; 237 return -ENXIO;
238 if (clt_frames == 0) 238 if (clt_frames == 0)
239 return 0; 239 return 0;
240 frames = clt_frames; 240 frames = clt_frames;
241 stream = snd_pcm_plug_stream(plug);
241 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 242 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
242 plugin = snd_pcm_plug_first(plug); 243 plugin = snd_pcm_plug_first(plug);
243 while (plugin && frames > 0) { 244 while (plugin && frames > 0) {