Commit fbc020b4 authored by Markus Elfring's avatar Markus Elfring Committed by Takashi Iwai

ALSA: emux: Adjust four checks for null pointers

MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written !…

Thus fix affected source code places.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 949a0c23
...@@ -99,7 +99,7 @@ snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index) ...@@ -99,7 +99,7 @@ snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index)
sprintf(tmpname, "%s Port %d", emu->name, i); sprintf(tmpname, "%s Port %d", emu->name, i);
p = snd_emux_create_port(emu, tmpname, MIDI_CHANNELS, p = snd_emux_create_port(emu, tmpname, MIDI_CHANNELS,
0, &pinfo); 0, &pinfo);
if (p == NULL) { if (!p) {
snd_printk(KERN_ERR "can't create port\n"); snd_printk(KERN_ERR "can't create port\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -151,7 +151,7 @@ snd_emux_create_port(struct snd_emux *emu, char *name, ...@@ -151,7 +151,7 @@ snd_emux_create_port(struct snd_emux *emu, char *name,
} }
p->chset.channels = kcalloc(max_channels, sizeof(*p->chset.channels), p->chset.channels = kcalloc(max_channels, sizeof(*p->chset.channels),
GFP_KERNEL); GFP_KERNEL);
if (p->chset.channels == NULL) { if (!p->chset.channels) {
snd_printk(KERN_ERR "no memory\n"); snd_printk(KERN_ERR "no memory\n");
kfree(p); kfree(p);
return NULL; return NULL;
...@@ -373,7 +373,7 @@ int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card) ...@@ -373,7 +373,7 @@ int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card)
return 0; return 0;
emu->vmidi = kcalloc(emu->midi_ports, sizeof(*emu->vmidi), GFP_KERNEL); emu->vmidi = kcalloc(emu->midi_ports, sizeof(*emu->vmidi), GFP_KERNEL);
if (emu->vmidi == NULL) if (!emu->vmidi)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < emu->midi_ports; i++) { for (i = 0; i < emu->midi_ports; i++) {
...@@ -405,7 +405,7 @@ int snd_emux_delete_virmidi(struct snd_emux *emu) ...@@ -405,7 +405,7 @@ int snd_emux_delete_virmidi(struct snd_emux *emu)
{ {
int i; int i;
if (emu->vmidi == NULL) if (!emu->vmidi)
return 0; return 0;
for (i = 0; i < emu->midi_ports; i++) { for (i = 0; i < emu->midi_ports; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment