ALSA: sound/parisc: Move dereference after NULL test
[pandora-kernel.git] / sound / parisc / harmony.c
index e924492..f47f9e2 100644 (file)
@@ -624,6 +624,9 @@ snd_harmony_pcm_init(struct snd_harmony *h)
        struct snd_pcm *pcm;
        int err;
 
+       if (snd_BUG_ON(!h))
+               return -EINVAL;
+
        harmony_disable_interrupts(h);
        
        err = snd_pcm_new(h->card, "harmony", 0, 1, 1, &pcm);
@@ -865,11 +868,12 @@ snd_harmony_mixer_reset(struct snd_harmony *h)
 static int __devinit
 snd_harmony_mixer_init(struct snd_harmony *h)
 {
-       struct snd_card *card = h->card;
+       struct snd_card *card;
        int idx, err;
 
        if (snd_BUG_ON(!h))
                return -EINVAL;
+       card = h->card;
        strcpy(card->mixername, "Harmony Gain control interface");
 
        for (idx = 0; idx < HARMONY_CONTROLS; idx++) {