alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: Takashi Iwai <tiwai@suse.de>
Cc: Jaroslav Kysela <perex@perex.cz>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org, trivial@kernel.org,
	Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: [PATCH resent] ALSA: emu10k1: Deletion of unnecessary checks before three function calls
Date: Mon, 03 Nov 2014 15:10:40 +0100	[thread overview]
Message-ID: <54578CE0.1090201@users.sourceforge.net> (raw)
In-Reply-To: <s5ha94839dx.wl-tiwai@suse.de>

[-- Attachment #1: Type: text/plain, Size: 604 bytes --]

> 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

[-- Attachment #2: 0001-ALSA-emu10k1-Deletion-of-unnecessary-checks-before-t.patch --]
[-- Type: text/x-patch, Size: 2120 bytes --]

>From 23bb7bd1325b7c9cc81761db3ebf3ea19f85338d Mon Sep 17 00:00:00 2001
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 3 Nov 2014 14:54:36 +0100
Subject: [PATCH] ALSA: 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,
-- 
2.1.3


  reply	other threads:[~2014-11-03 14:10 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5307CAA2.8060406@users.sourceforge.net>
     [not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
     [not found]   ` <530A086E.8010901@users.sourceforge.net>
     [not found]     ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
     [not found]       ` <530A72AA.3000601@users.sourceforge.net>
     [not found]         ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
     [not found]           ` <530B5FB6.6010207@users.sourceforge.net>
     [not found]             ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
     [not found]               ` <530C5E18.1020800@users.sourceforge.net>
     [not found]                 ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
     [not found]                   ` <530CD2C4.4050903@users.sourceforge.net>
     [not found]                     ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
     [not found]                       ` <530CF8FF.8080600@users.sourceforge.net>
     [not found]                         ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
     [not found]                           ` <530DD06F.4090703@users.sourceforge.net>
     [not found]                             ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
     [not found]                               ` <5317A59D.4@users.so urceforge.net>
     [not found]                                 ` <5317A59D.4@users.sourceforge.net>
2014-11-02 18:27                                   ` [PATCH 1/1] PCI: EMU10K1: Deletion of unnecessary checks before three function calls SF Markus Elfring
2014-11-03  9:45                                     ` Takashi Iwai
2014-11-03 14:10                                       ` SF Markus Elfring [this message]
2014-11-03 14:17                                         ` [PATCH resent] ALSA: emu10k1: " Takashi Iwai
2014-11-17 10:07                                   ` [PATCH 1/1] ALSA: hda: Deletion of unnecessary checks before two " SF Markus Elfring
2014-11-17 12:45                                     ` Takashi Iwai
2014-11-17 10:34                                   ` [PATCH 1/1] ALSA: ice17xx: Deletion of unnecessary checks before the function call "snd_ac97_resume" SF Markus Elfring
2014-11-17 12:46                                     ` Takashi Iwai
2014-11-17 11:48                                   ` [PATCH 1/1] ALSA: lola: Deletion of an unnecessary check before the function call "vfree" SF Markus Elfring
2014-11-17 12:46                                     ` Takashi Iwai
2014-11-17 12:12                                   ` [PATCH 1/1] ALSA: hdsp: Deletion of an unnecessary check before the function call "release_firmware" SF Markus Elfring
2014-11-17 12:47                                     ` Takashi Iwai
2014-11-17 12:41                                   ` [PATCH 1/1] ALSA: powermac: Deletion of an unnecessary check before the function call "pci_dev_put" SF Markus Elfring
2014-11-17 12:53                                     ` Takashi Iwai
2014-11-17 13:15                                   ` ASoC: omap-mcbsp: Deletion of an unnecessary check before the function call "kfree" SF Markus Elfring
2014-11-17 19:11                                     ` Jarkko Nikula
2014-11-18  9:40                                     ` Mark Brown
2014-11-21 17:40                                   ` [PATCH 1/1] ALSA: core: Deletion of unnecessary checks before two function calls SF Markus Elfring
2014-11-21 19:07                                     ` Takashi Iwai
2014-11-21 18:11                                   ` [PATCH 1/1] ALSA: es1688_lib: Deletion of an unnecessary check before the function call "release_and_free_resource" SF Markus Elfring
2014-11-21 19:08                                     ` Takashi Iwai
2014-11-21 18:35                                   ` [PATCH 1/1] ALSA: sb: Deletion of unnecessary checks before two function calls SF Markus Elfring
2014-11-21 19:08                                     ` Takashi Iwai
2014-12-02 13:41                                   ` [PATCH 1/1] ASoC: fsi: Deletion of unnecessary checks before the function call "clk_disable" SF Markus Elfring
2014-12-03 18:29                                     ` Mark Brown
2014-12-02 16:40                                   ` [PATCH 1/1] ASoC: mop500: Deletion of unnecessary checks before the function call "of_node_put" SF Markus Elfring
2014-12-03 18:30                                     ` Mark Brown
2014-12-03 18:31                                     ` Mark Brown
2014-12-02 17:11                                   ` [PATCH 1/1] ALSA: asihpi: Deletion of an unnecessary check before the function call "vfree" SF Markus Elfring
2014-12-02 17:39                                     ` Takashi Iwai
2014-12-02 17:38                                   ` [PATCH 1/1] ALSA: echoaudio: Deletion of a check before release_and_free_resource() SF Markus Elfring
2014-12-02 17:40                                     ` Takashi Iwai
2014-12-02 17:56                                   ` [PATCH 1/1] ALSA: trident: Deletion of a check before snd_util_memhdr_free() SF Markus Elfring
2014-12-02 19:11                                     ` Takashi Iwai
2014-12-02 20:50                                   ` [PATCH 0/2] ALSA: ctxfi: Delete an unnecessary check before kfree() SF Markus Elfring
2014-12-02 20:55                                     ` [PATCH 1/2] ALSA: ctxfi: Deletion of an unnecessary check before the function call "kfree" SF Markus Elfring
2014-12-02 21:07                                       ` Joe Perches
2014-12-02 21:00                                     ` [PATCH 2/2] ALSA: ctxfi: One function call less in get_daio_rsc() after error detection SF Markus Elfring
2014-12-03  6:51                                     ` [PATCH 0/2] ALSA: ctxfi: Delete an unnecessary check before kfree() Takashi Iwai
2014-12-03 11:38                                       ` SF Markus Elfring
2014-12-03 12:41                                         ` Takashi Iwai
2014-12-03 17:14                                           ` Joe Perches
2014-12-03 17:30                                             ` Takashi Iwai
2014-12-03 17:59                                               ` [PATCH] ALSA: ctxfi: Neaten get_daio_rsc Joe Perches
2014-12-03 19:31                                                 ` Takashi Iwai
2014-12-02 21:55                                   ` [PATCH] ALSA: i2sbus: Deletion of unnecessary checks before the function call "release_and_free_resource" SF Markus Elfring
2014-12-03  6:59                                     ` Takashi Iwai
2015-01-04 12:43                                   ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks SF Markus Elfring
2015-01-04 12:50                                     ` [PATCH 1/13] ALSA: seq: Deletion of unnecessary checks before the function call "snd_midi_event_free" SF Markus Elfring
2015-01-04 12:53                                     ` [PATCH 2/13] ALSA: oss: Deletion of unnecessary checks before the function call "vfree" SF Markus Elfring
2015-01-04 12:55                                     ` [PATCH 3/13] ALSA: emu10k1: Delete an unnecessary check before the function call "kfree" SF Markus Elfring
2015-01-04 13:00                                     ` [PATCH 4/13] ALSA: oxygen: Delete an unnecessary check before the function call "snd_pcm_suspend" SF Markus Elfring
2015-01-04 13:02                                     ` [PATCH 5/13] ALSA: emux: Delete an unnecessary check before the function call "snd_sf_free" SF Markus Elfring
2015-01-04 13:08                                     ` [PATCH 6/13] ASoC: Intel: Delete an unnecessary check before the function call "sst_dma_free" SF Markus Elfring
2015-01-05 14:35                                       ` Mark Brown
2015-01-05 15:18                                         ` Takashi Iwai
2015-01-05 18:22                                           ` Mark Brown
2015-01-05 19:02                                       ` Mark Brown
2015-01-04 13:11                                     ` [PATCH 7/13] ASoC: fsi: Deletion of unnecessary checks before the function call "clk_enable" SF Markus Elfring
2015-01-05 19:03                                       ` Mark Brown
2015-01-04 13:14                                     ` [PATCH 8/13] ASoC: Intel: Delete an unnecessary check before the function call "release_firmware" SF Markus Elfring
2015-01-05 19:03                                       ` Mark Brown
2015-01-04 13:21                                     ` [PATCH 9/13] ALSA: i2sbus: Delete an unnecessary check before the function call "snd_pcm_suspend_all" SF Markus Elfring
2015-01-04 13:28                                     ` [PATCH 10/13] ALSA: sb: Delete an unnecessary check before the function call "snd_emux_free" SF Markus Elfring
2015-01-04 13:36                                     ` [PATCH 11/13] ALSA: Deletion of checks before the function call "iounmap" SF Markus Elfring
2015-01-05 13:58                                       ` Dan Carpenter
2016-10-26 12:26                                       ` Dan Carpenter
2016-10-26 12:28                                         ` Johannes Berg
2016-10-26 12:42                                           ` Dan Carpenter
2015-01-04 13:38                                     ` [PATCH 12/13] ALSA: msnd: One function call less in snd_msnd_attach() after error detection SF Markus Elfring
2015-01-04 14:18                                       ` Takashi Iwai
2015-01-04 13:41                                     ` [PATCH 13/13] ALSA: msnd: Fix centralized exiting from snd_msnd_attach() SF Markus Elfring
2015-01-04 14:22                                     ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks Takashi Iwai
2015-06-28  9:21                                   ` [PATCH] ALSA: hda: Delete an unnecessary check before the function call "snd_info_free_entry" SF Markus Elfring
2015-06-29  9:03                                     ` Takashi Iwai
2015-07-08 19:31                                   ` [PATCH] ALSA: hda: Delete an unnecessary check before the function call "kobject_put" SF Markus Elfring
2015-07-09 12:21                                     ` Takashi Iwai
2016-07-22 17:07                                   ` [PATCH] ASoC: Intel: Skylake: Delete an unnecessary check before the function call "release_firmware" SF Markus Elfring
2016-07-24 21:06                                     ` Applied "ASoC: Intel: Skylake: Delete an unnecessary check before the function call "release_firmware"" to the asoc tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54578CE0.1090201@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=cocci@systeme.lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).