]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - sound/core/timer.c
Merge tag 'sound-4.20-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
[linux.git] / sound / core / timer.c
index b6f076bbc72d14be37893e20b19cbfaedf2f728b..61a0cec6e1f665f9c2a47faee0d716872e537b1e 100644 (file)
@@ -883,6 +883,11 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
 
        if (snd_BUG_ON(!tid))
                return -EINVAL;
+       if (tid->dev_class == SNDRV_TIMER_CLASS_CARD ||
+           tid->dev_class == SNDRV_TIMER_CLASS_PCM) {
+               if (WARN_ON(!card))
+                       return -EINVAL;
+       }
        if (rtimer)
                *rtimer = NULL;
        timer = kzalloc(sizeof(*timer), GFP_KERNEL);