[alsa-devel] [PATCH 1/1] PCI: EMU10K1: Deletion of unnecessary checks before three function calls
The functions kfree(), release_firmware() and snd_util_memhdr_free() test whether their argument is NULL and then return 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 --- sound/pci/emu10k1/emu10k1_main.c | 9 +++------ sound/pci/emu10k1/emufx.c | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 2292697..b4458a6 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -1289,10 +1289,8 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) } if (emu->emu1010.firmware_thread) kthread_stop(emu->emu1010.firmware_thread); - if (emu->firmware) - release_firmware(emu->firmware); - if (emu->dock_fw) - release_firmware(emu->dock_fw); + release_firmware(emu->firmware); + release_firmware(emu->dock_fw); if (emu->irq >= 0) free_irq(emu->irq, emu); /* remove reserved page */ @@ -1301,8 +1299,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) (struct snd_util_memblk *)emu->reserved_page); emu->reserved_page = NULL; } - if (emu->memhdr) - snd_util_memhdr_free(emu->memhdr); + snd_util_memhdr_free(emu->memhdr); if (emu->silent_page.area) snd_dma_free_pages(&emu->silent_page); if (emu->ptb_pages.area) diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 745f062..eb5c0ab 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -777,8 +777,7 @@ static void snd_emu10k1_ctl_private_free(struct snd_kcontrol *kctl) kctl->private_value = 0; list_del(&ctl->list); kfree(ctl); - if (kctl->tlv.p) - kfree(kctl->tlv.p); + kfree(kctl->tlv.p); }
static int snd_emu10k1_add_controls(struct snd_emu10k1 *emu,
At Sun, 02 Nov 2014 19:27:20 +0100, SF Markus Elfring wrote:
The functions kfree(), release_firmware() and snd_util_memhdr_free() test whether their argument is NULL and then return 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
Your patch can't be applied cleanly due to your MUA breaking the lines. Please fix your MUA setup, or use an attachment if it's impossible, and resend the patch.
Also, try to align the subject line with the relevant commits. See "git log sound/pci/emu10k1"
thanks,
Takashi
sound/pci/emu10k1/emu10k1_main.c | 9 +++------ sound/pci/emu10k1/emufx.c | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 2292697..b4458a6 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -1289,10 +1289,8 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) } if (emu->emu1010.firmware_thread) kthread_stop(emu->emu1010.firmware_thread);
- if (emu->firmware)
release_firmware(emu->firmware);
- if (emu->dock_fw)
release_firmware(emu->dock_fw);
- release_firmware(emu->firmware);
- release_firmware(emu->dock_fw); if (emu->irq >= 0) free_irq(emu->irq, emu); /* remove reserved page */
@@ -1301,8 +1299,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) (struct snd_util_memblk *)emu->reserved_page); emu->reserved_page = NULL; }
- if (emu->memhdr)
snd_util_memhdr_free(emu->memhdr);
- snd_util_memhdr_free(emu->memhdr); if (emu->silent_page.area) snd_dma_free_pages(&emu->silent_page); if (emu->ptb_pages.area)
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 745f062..eb5c0ab 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -777,8 +777,7 @@ static void snd_emu10k1_ctl_private_free(struct snd_kcontrol *kctl) kctl->private_value = 0; list_del(&ctl->list); kfree(ctl);
- if (kctl->tlv.p)
kfree(kctl->tlv.p);
- kfree(kctl->tlv.p);
}
static int snd_emu10k1_add_controls(struct snd_emu10k1 *emu,
2.1.3
Your patch can't be applied cleanly due to your MUA breaking the lines. Please fix your MUA setup, or use an attachment if it's impossible, and resend the patch.
Thanks for your feedback.
Does this example show a conflict between long comments like "snd_emu10k1_ctl_private_free( ... *kctl)" after patch ranges and line length limitation for email eventually?
Also, try to align the subject line with the relevant commits. See "git log sound/pci/emu10k1"
I have attached my update suggestion with a slightly different commit title as before. Is this variant acceptable?
Regards, Markus
At Mon, 03 Nov 2014 15:10:40 +0100, SF Markus Elfring wrote:
Your patch can't be applied cleanly due to your MUA breaking the lines. Please fix your MUA setup, or use an attachment if it's impossible, and resend the patch.
Thanks for your feedback.
Does this example show a conflict between long comments like "snd_emu10k1_ctl_private_free( ... *kctl)" after patch ranges and line length limitation for email eventually?
Conflict? It's your MUA that is broken.
Also, try to align the subject line with the relevant commits. See "git log sound/pci/emu10k1"
I have attached my update suggestion with a slightly different commit title as before. Is this variant acceptable?
So, you couldn't fix your MUA? That's bad for you. Many maintainers dislike attachments and won't accept such patches.
Couldn't you simply send a patch via git-send-email?
In anyway, I applied the patch now. Thanks.
Takashi
participants (2)
-
SF Markus Elfring
-
Takashi Iwai