ALSA: firewire-lib: suppress kernel warnings when releasing uninitialized stream...
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 30 Mar 2016 23:47:02 +0000 (08:47 +0900)
committerTakashi Iwai <tiwai@suse.de>
Thu, 31 Mar 2016 13:36:17 +0000 (15:36 +0200)
When any of AMDTP stream data are not initialized and private data is
going to be released, WARN_ON() in amdtp_stream_destroy() is hit and
dump messages. This may take users irritated.

This commit fixes the bug to skip releasing when it's not initialized.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/amdtp-stream.c

index ed2902609a4c6cd0fd854e6ee29f6eaa866499c0..4484242da0e642d53c4c5c992983bd5fbe0e9b94 100644 (file)
@@ -102,6 +102,10 @@ EXPORT_SYMBOL(amdtp_stream_init);
  */
 void amdtp_stream_destroy(struct amdtp_stream *s)
 {
+       /* Not initialized. */
+       if (s->protocol == NULL)
+               return;
+
        WARN_ON(amdtp_stream_running(s));
        kfree(s->protocol);
        mutex_destroy(&s->mutex);