ALSA: seq: Deletion of unnecessary checks before the function call "snd_midi_event_free"
authorMarkus Elfring <elfring@users.sourceforge.net>
Sat, 3 Jan 2015 13:54:56 +0000 (14:54 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sun, 4 Jan 2015 14:11:05 +0000 (15:11 +0100)
The snd_midi_event_free() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/seq/oss/seq_oss_midi.c
sound/core/seq/seq_midi.c

index 3a4569669efa4b561b2751d9d1170e69ee2f4b47..e79cc44b1394e68c07d8eab6c00c3868522f8c03 100644 (file)
@@ -237,8 +237,7 @@ snd_seq_oss_midi_check_exit_port(int client, int port)
                spin_unlock_irqrestore(&register_lock, flags);
                snd_use_lock_free(&mdev->use_lock);
                snd_use_lock_sync(&mdev->use_lock);
-               if (mdev->coder)
-                       snd_midi_event_free(mdev->coder);
+               snd_midi_event_free(mdev->coder);
                kfree(mdev);
        }
        spin_lock_irqsave(&register_lock, flags);
@@ -265,8 +264,7 @@ snd_seq_oss_midi_clear_all(void)
        spin_lock_irqsave(&register_lock, flags);
        for (i = 0; i < max_midi_devs; i++) {
                if ((mdev = midi_devs[i]) != NULL) {
-                       if (mdev->coder)
-                               snd_midi_event_free(mdev->coder);
+                       snd_midi_event_free(mdev->coder);
                        kfree(mdev);
                        midi_devs[i] = NULL;
                }
index a1fd77af60593e26de9cf4c560e8a3b80412d797..68fec776da2619db52163b143551b6e045ce2ee8 100644 (file)
@@ -268,8 +268,7 @@ static void snd_seq_midisynth_delete(struct seq_midisynth *msynth)
                snd_seq_event_port_detach(msynth->seq_client, msynth->seq_port);
        }
 
-       if (msynth->parser)
-               snd_midi_event_free(msynth->parser);
+       snd_midi_event_free(msynth->parser);
 }
 
 /* register new midi synth port */