ALSA: core: fix NULL checking in snd_pcm_plug_slave_size()
authorXi Wang <xi.wang@gmail.com>
Tue, 13 Nov 2012 22:12:12 +0000 (17:12 -0500)
committerTakashi Iwai <tiwai@suse.de>
Wed, 14 Nov 2012 07:03:31 +0000 (08:03 +0100)
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>
sound/core/oss/pcm_plugin.c

index f0d7b1566a1050373865d31c284cfab92b5e676c..727ac44d39f4a64f7ba203d8dd839caaa66c15ec 100644 (file)
@@ -231,13 +231,14 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc
 {
        struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next;
        snd_pcm_sframes_t frames;
-       int stream = snd_pcm_plug_stream(plug);
+       int stream;
        
        if (snd_BUG_ON(!plug))
                return -ENXIO;
        if (clt_frames == 0)
                return 0;
        frames = clt_frames;
+       stream = snd_pcm_plug_stream(plug);
        if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
                plugin = snd_pcm_plug_first(plug);
                while (plugin && frames > 0) {