* [PATCH 1/1] PCI: EMU10K1: Deletion of unnecessary checks before three function calls [not found] ` <5317A59D.4@users.sourceforge.net> @ 2014-11-02 18:27 ` SF Markus Elfring 2014-11-03 9:45 ` Takashi Iwai 2014-11-17 10:07 ` [PATCH 1/1] ALSA: hda: Deletion of unnecessary checks before two " SF Markus Elfring ` (19 subsequent siblings) 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-11-02 18:27 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: linux-kernel, kernel-janitors, trivial, Coccinelle 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 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] PCI: EMU10K1: Deletion of unnecessary checks before three function calls 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 ` [PATCH resent] ALSA: emu10k1: " SF Markus Elfring 0 siblings, 1 reply; 79+ messages in thread From: Takashi Iwai @ 2014-11-03 9:45 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, linux-kernel, kernel-janitors, trivial, Coccinelle 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 > > ^ permalink raw reply [flat|nested] 79+ messages in thread
* Re: [PATCH resent] ALSA: emu10k1: Deletion of unnecessary checks before three function calls 2014-11-03 9:45 ` Takashi Iwai @ 2014-11-03 14:10 ` SF Markus Elfring 2014-11-03 14:17 ` Takashi Iwai 0 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-11-03 14:10 UTC (permalink / raw) To: Takashi Iwai Cc: Jaroslav Kysela, alsa-devel, linux-kernel, kernel-janitors, trivial, Coccinelle [-- 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 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH resent] ALSA: emu10k1: Deletion of unnecessary checks before three function calls 2014-11-03 14:10 ` [PATCH resent] ALSA: emu10k1: " SF Markus Elfring @ 2014-11-03 14:17 ` Takashi Iwai 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2014-11-03 14:17 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, linux-kernel, kernel-janitors, trivial, Coccinelle 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 ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/1] ALSA: hda: Deletion of unnecessary checks before two function calls [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-17 10:07 ` 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 ` (18 subsequent siblings) 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-11-17 10:07 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Coccinelle From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 17 Nov 2014 10:44:33 +0100 The functions kfree() and release_firmware() 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/hda/hda_codec.c | 3 +-- sound/pci/hda/hda_intel.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index ec6a7d0..3fe8859 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -827,8 +827,7 @@ static void snd_hda_bus_free(struct hda_bus *bus) WARN_ON(!list_empty(&bus->codec_list)); if (bus->workq) flush_workqueue(bus->workq); - if (bus->unsol) - kfree(bus->unsol); + kfree(bus->unsol); if (bus->ops.private_free) bus->ops.private_free(bus); if (bus->workq) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 0a7f848..b4ec4e1 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1129,8 +1129,7 @@ static int azx_free(struct azx *chip) pci_disable_device(chip->pci); kfree(chip->azx_dev); #ifdef CONFIG_SND_HDA_PATCH_LOADER - if (chip->fw) - release_firmware(chip->fw); + release_firmware(chip->fw); #endif if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { hda_display_power(false); -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] ALSA: hda: Deletion of unnecessary checks before two function calls 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2014-11-17 12:45 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Coccinelle At Mon, 17 Nov 2014 11:07:04 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Mon, 17 Nov 2014 10:44:33 +0100 > > The functions kfree() and release_firmware() 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> Applied, thanks. Takashi > --- > sound/pci/hda/hda_codec.c | 3 +-- > sound/pci/hda/hda_intel.c | 3 +-- > 2 files changed, 2 insertions(+), 4 deletions(-) > > diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c > index ec6a7d0..3fe8859 100644 > --- a/sound/pci/hda/hda_codec.c > +++ b/sound/pci/hda/hda_codec.c > @@ -827,8 +827,7 @@ static void snd_hda_bus_free(struct hda_bus *bus) > WARN_ON(!list_empty(&bus->codec_list)); > if (bus->workq) > flush_workqueue(bus->workq); > - if (bus->unsol) > - kfree(bus->unsol); > + kfree(bus->unsol); > if (bus->ops.private_free) > bus->ops.private_free(bus); > if (bus->workq) > diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c > index 0a7f848..b4ec4e1 100644 > --- a/sound/pci/hda/hda_intel.c > +++ b/sound/pci/hda/hda_intel.c > @@ -1129,8 +1129,7 @@ static int azx_free(struct azx *chip) > pci_disable_device(chip->pci); > kfree(chip->azx_dev); > #ifdef CONFIG_SND_HDA_PATCH_LOADER > - if (chip->fw) > - release_firmware(chip->fw); > + release_firmware(chip->fw); > #endif > if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { > hda_display_power(false); > -- > 2.1.3 > > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/1] ALSA: ice17xx: Deletion of unnecessary checks before the function call "snd_ac97_resume" [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-17 10:07 ` [PATCH 1/1] ALSA: hda: Deletion of unnecessary checks before two " SF Markus Elfring @ 2014-11-17 10:34 ` 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 ` (17 subsequent siblings) 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-11-17 10:34 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Coccinelle From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 17 Nov 2014 11:28:02 +0100 The snd_ac97_resume() 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> --- sound/pci/ice1712/ice1712.c | 3 +-- sound/pci/ice1712/ice1724.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 87f7fc4..e1e18b5 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -2905,8 +2905,7 @@ static int snd_ice1712_resume(struct device *dev) outw(ice->pm_saved_spdif_ctrl, ICEMT(ice, ROUTE_SPDOUT)); outw(ice->pm_saved_route, ICEMT(ice, ROUTE_PSDOUT03)); - if (ice->ac97) - snd_ac97_resume(ice->ac97); + snd_ac97_resume(ice->ac97); snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0; diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 08cb08a..0e56835 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -2884,8 +2884,7 @@ static int snd_vt1724_resume(struct device *dev) outb(ice->pm_saved_spdif_cfg, ICEREG1724(ice, SPDIF_CFG)); outl(ice->pm_saved_route, ICEMT1724(ice, ROUTE_PLAYBACK)); - if (ice->ac97) - snd_ac97_resume(ice->ac97); + snd_ac97_resume(ice->ac97); snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0; -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] ALSA: ice17xx: Deletion of unnecessary checks before the function call "snd_ac97_resume" 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2014-11-17 12:46 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Coccinelle At Mon, 17 Nov 2014 11:34:22 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Mon, 17 Nov 2014 11:28:02 +0100 > > The snd_ac97_resume() 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> Applied, thanks. Takashi > --- > sound/pci/ice1712/ice1712.c | 3 +-- > sound/pci/ice1712/ice1724.c | 3 +-- > 2 files changed, 2 insertions(+), 4 deletions(-) > > diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c > index 87f7fc4..e1e18b5 100644 > --- a/sound/pci/ice1712/ice1712.c > +++ b/sound/pci/ice1712/ice1712.c > @@ -2905,8 +2905,7 @@ static int snd_ice1712_resume(struct device *dev) > outw(ice->pm_saved_spdif_ctrl, ICEMT(ice, ROUTE_SPDOUT)); > outw(ice->pm_saved_route, ICEMT(ice, ROUTE_PSDOUT03)); > > - if (ice->ac97) > - snd_ac97_resume(ice->ac97); > + snd_ac97_resume(ice->ac97); > > snd_power_change_state(card, SNDRV_CTL_POWER_D0); > return 0; > diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c > index 08cb08a..0e56835 100644 > --- a/sound/pci/ice1712/ice1724.c > +++ b/sound/pci/ice1712/ice1724.c > @@ -2884,8 +2884,7 @@ static int snd_vt1724_resume(struct device *dev) > outb(ice->pm_saved_spdif_cfg, ICEREG1724(ice, SPDIF_CFG)); > outl(ice->pm_saved_route, ICEMT1724(ice, ROUTE_PLAYBACK)); > > - if (ice->ac97) > - snd_ac97_resume(ice->ac97); > + snd_ac97_resume(ice->ac97); > > snd_power_change_state(card, SNDRV_CTL_POWER_D0); > return 0; > -- > 2.1.3 > > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/1] ALSA: lola: Deletion of an unnecessary check before the function call "vfree" [not found] ` <5317A59D.4@users.sourceforge.net> ` (2 preceding siblings ...) 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 11:48 ` 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 ` (16 subsequent siblings) 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-11-17 11:48 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Coccinelle From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 17 Nov 2014 12:42:16 +0100 The vfree() function performs also input parameter validation. 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/lola/lola_mixer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/pci/lola/lola_mixer.c b/sound/pci/lola/lola_mixer.c index 782f4d8..e7fe15d 100644 --- a/sound/pci/lola/lola_mixer.c +++ b/sound/pci/lola/lola_mixer.c @@ -108,8 +108,7 @@ int lola_init_pins(struct lola *chip, int dir, int *nidp) void lola_free_mixer(struct lola *chip) { - if (chip->mixer.array_saved) - vfree(chip->mixer.array_saved); + vfree(chip->mixer.array_saved); } int lola_init_mixer_widget(struct lola *chip, int nid) -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] ALSA: lola: Deletion of an unnecessary check before the function call "vfree" 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2014-11-17 12:46 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Coccinelle At Mon, 17 Nov 2014 12:48:44 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Mon, 17 Nov 2014 12:42:16 +0100 > > The vfree() function performs also input parameter validation. 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> Applied, thanks. Takashi > --- > sound/pci/lola/lola_mixer.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/sound/pci/lola/lola_mixer.c b/sound/pci/lola/lola_mixer.c > index 782f4d8..e7fe15d 100644 > --- a/sound/pci/lola/lola_mixer.c > +++ b/sound/pci/lola/lola_mixer.c > @@ -108,8 +108,7 @@ int lola_init_pins(struct lola *chip, int dir, int *nidp) > > void lola_free_mixer(struct lola *chip) > { > - if (chip->mixer.array_saved) > - vfree(chip->mixer.array_saved); > + vfree(chip->mixer.array_saved); > } > > int lola_init_mixer_widget(struct lola *chip, int nid) > -- > 2.1.3 > > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/1] ALSA: hdsp: Deletion of an unnecessary check before the function call "release_firmware" [not found] ` <5317A59D.4@users.sourceforge.net> ` (3 preceding siblings ...) 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:12 ` 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 ` (15 subsequent siblings) 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-11-17 12:12 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Coccinelle From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 17 Nov 2014 13:04:14 +0100 The release_firmware() function tests whether its 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/rme9652/hdsp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 7646ba1..0ae568d 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -5368,8 +5368,7 @@ static int snd_hdsp_free(struct hdsp *hdsp) snd_hdsp_free_buffers(hdsp); - if (hdsp->firmware) - release_firmware(hdsp->firmware); + release_firmware(hdsp->firmware); vfree(hdsp->fw_uploaded); if (hdsp->iobase) -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] ALSA: hdsp: Deletion of an unnecessary check before the function call "release_firmware" 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2014-11-17 12:47 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Coccinelle At Mon, 17 Nov 2014 13:12:15 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Mon, 17 Nov 2014 13:04:14 +0100 > > The release_firmware() function tests whether its 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> Applied, thanks. Takashi > --- > sound/pci/rme9652/hdsp.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c > index 7646ba1..0ae568d 100644 > --- a/sound/pci/rme9652/hdsp.c > +++ b/sound/pci/rme9652/hdsp.c > @@ -5368,8 +5368,7 @@ static int snd_hdsp_free(struct hdsp *hdsp) > > snd_hdsp_free_buffers(hdsp); > > - if (hdsp->firmware) > - release_firmware(hdsp->firmware); > + release_firmware(hdsp->firmware); > vfree(hdsp->fw_uploaded); > > if (hdsp->iobase) > -- > 2.1.3 > > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/1] ALSA: powermac: Deletion of an unnecessary check before the function call "pci_dev_put" [not found] ` <5317A59D.4@users.sourceforge.net> ` (4 preceding siblings ...) 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:41 ` 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 ` (14 subsequent siblings) 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-11-17 12:41 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Coccinelle From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 17 Nov 2014 13:35:54 +0100 The pci_dev_put() 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> --- sound/ppc/pmac.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index 8a431bc..5a13b22 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c @@ -887,8 +887,7 @@ static int snd_pmac_free(struct snd_pmac *chip) } } - if (chip->pdev) - pci_dev_put(chip->pdev); + pci_dev_put(chip->pdev); of_node_put(chip->node); kfree(chip); return 0; -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] ALSA: powermac: Deletion of an unnecessary check before the function call "pci_dev_put" 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2014-11-17 12:53 UTC (permalink / raw) To: SF Markus Elfring; +Cc: Coccinelle, alsa-devel, kernel-janitors, LKML At Mon, 17 Nov 2014 13:41:19 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Mon, 17 Nov 2014 13:35:54 +0100 > > The pci_dev_put() 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> Applied, thanks. Takashi > --- > sound/ppc/pmac.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c > index 8a431bc..5a13b22 100644 > --- a/sound/ppc/pmac.c > +++ b/sound/ppc/pmac.c > @@ -887,8 +887,7 @@ static int snd_pmac_free(struct snd_pmac *chip) > } > } > > - if (chip->pdev) > - pci_dev_put(chip->pdev); > + pci_dev_put(chip->pdev); > of_node_put(chip->node); > kfree(chip); > return 0; > -- > 2.1.3 > > ^ permalink raw reply [flat|nested] 79+ messages in thread
* ASoC: omap-mcbsp: Deletion of an unnecessary check before the function call "kfree" [not found] ` <5317A59D.4@users.sourceforge.net> ` (5 preceding siblings ...) 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 13:15 ` 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 ` (13 subsequent siblings) 20 siblings, 2 replies; 79+ messages in thread From: SF Markus Elfring @ 2014-11-17 13:15 UTC (permalink / raw) To: Jarkko Nikula, Jaroslav Kysela, Liam Girdwood, Mark Brown, Peter Ujfalusi, Takashi Iwai, linux-omap, alsa-devel Cc: LKML, kernel-janitors, Coccinelle From: Markus Elfring <elfring@users.sourceforge.net> Date: Mon, 17 Nov 2014 14:05:27 +0100 The kfree() 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> --- sound/soc/omap/mcbsp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c index 86c7538..68a1252 100644 --- a/sound/soc/omap/mcbsp.c +++ b/sound/soc/omap/mcbsp.c @@ -621,8 +621,7 @@ void omap_mcbsp_free(struct omap_mcbsp *mcbsp) mcbsp->reg_cache = NULL; spin_unlock(&mcbsp->lock); - if (reg_cache) - kfree(reg_cache); + kfree(reg_cache); } /* -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: ASoC: omap-mcbsp: Deletion of an unnecessary check before the function call "kfree" 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 1 sibling, 0 replies; 79+ messages in thread From: Jarkko Nikula @ 2014-11-17 19:11 UTC (permalink / raw) To: SF Markus Elfring, Jaroslav Kysela, Liam Girdwood, Mark Brown, Peter Ujfalusi, Takashi Iwai, linux-omap, alsa-devel Cc: kernel-janitors, LKML, Coccinelle On 11/17/2014 03:15 PM, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Mon, 17 Nov 2014 14:05:27 +0100 > > The kfree() 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> > --- > sound/soc/omap/mcbsp.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com> ^ permalink raw reply [flat|nested] 79+ messages in thread
* Re: ASoC: omap-mcbsp: Deletion of an unnecessary check before the function call "kfree" 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 1 sibling, 0 replies; 79+ messages in thread From: Mark Brown @ 2014-11-18 9:40 UTC (permalink / raw) To: SF Markus Elfring Cc: Jarkko Nikula, Jaroslav Kysela, Liam Girdwood, Peter Ujfalusi, Takashi Iwai, linux-omap, alsa-devel, LKML, kernel-janitors, Coccinelle [-- Attachment #1: Type: text/plain, Size: 326 bytes --] On Mon, Nov 17, 2014 at 02:15:01PM +0100, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Mon, 17 Nov 2014 14:05:27 +0100 > > The kfree() function tests whether its argument is NULL and then > returns immediately. Thus the test around the call is not needed. Applied, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/1] ALSA: core: Deletion of unnecessary checks before two function calls [not found] ` <5317A59D.4@users.sourceforge.net> ` (6 preceding siblings ...) 2014-11-17 13:15 ` ASoC: omap-mcbsp: Deletion of an unnecessary check before the function call "kfree" SF Markus Elfring @ 2014-11-21 17:40 ` 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 ` (12 subsequent siblings) 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-11-21 17:40 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Fri, 21 Nov 2014 18:34:48 +0100 The functions snd_seq_oss_timer_delete() and vunmap() perform also input parameter validation. 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/core/seq/oss/seq_oss_init.c | 9 +++------ sound/core/sgbuf.c | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c index b9184d2..b0e32e1 100644 --- a/sound/core/seq/oss/seq_oss_init.c +++ b/sound/core/seq/oss/seq_oss_init.c @@ -403,14 +403,11 @@ free_devinfo(void *private) { struct seq_oss_devinfo *dp = (struct seq_oss_devinfo *)private; - if (dp->timer) - snd_seq_oss_timer_delete(dp->timer); + snd_seq_oss_timer_delete(dp->timer); - if (dp->writeq) - snd_seq_oss_writeq_delete(dp->writeq); + snd_seq_oss_writeq_delete(dp->writeq); - if (dp->readq) - snd_seq_oss_readq_delete(dp->readq); + snd_seq_oss_readq_delete(dp->readq); kfree(dp); } diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c index 0a41850..84fffab 100644 --- a/sound/core/sgbuf.c +++ b/sound/core/sgbuf.c @@ -39,8 +39,7 @@ int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab) if (! sgbuf) return -EINVAL; - if (dmab->area) - vunmap(dmab->area); + vunmap(dmab->area); dmab->area = NULL; tmpb.dev.type = SNDRV_DMA_TYPE_DEV; -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] ALSA: core: Deletion of unnecessary checks before two function calls 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2014-11-21 19:07 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall At Fri, 21 Nov 2014 18:40:49 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Fri, 21 Nov 2014 18:34:48 +0100 > > The functions snd_seq_oss_timer_delete() and vunmap() perform also input > parameter validation. 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> Applied, thanks. Takashi > --- > sound/core/seq/oss/seq_oss_init.c | 9 +++------ > sound/core/sgbuf.c | 3 +-- > 2 files changed, 4 insertions(+), 8 deletions(-) > > diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c > index b9184d2..b0e32e1 100644 > --- a/sound/core/seq/oss/seq_oss_init.c > +++ b/sound/core/seq/oss/seq_oss_init.c > @@ -403,14 +403,11 @@ free_devinfo(void *private) > { > struct seq_oss_devinfo *dp = (struct seq_oss_devinfo *)private; > > - if (dp->timer) > - snd_seq_oss_timer_delete(dp->timer); > + snd_seq_oss_timer_delete(dp->timer); > > - if (dp->writeq) > - snd_seq_oss_writeq_delete(dp->writeq); > + snd_seq_oss_writeq_delete(dp->writeq); > > - if (dp->readq) > - snd_seq_oss_readq_delete(dp->readq); > + snd_seq_oss_readq_delete(dp->readq); > > kfree(dp); > } > diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c > index 0a41850..84fffab 100644 > --- a/sound/core/sgbuf.c > +++ b/sound/core/sgbuf.c > @@ -39,8 +39,7 @@ int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab) > if (! sgbuf) > return -EINVAL; > > - if (dmab->area) > - vunmap(dmab->area); > + vunmap(dmab->area); > dmab->area = NULL; > > tmpb.dev.type = SNDRV_DMA_TYPE_DEV; > -- > 2.1.3 > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/1] ALSA: es1688_lib: Deletion of an unnecessary check before the function call "release_and_free_resource" [not found] ` <5317A59D.4@users.sourceforge.net> ` (7 preceding siblings ...) 2014-11-21 17:40 ` [PATCH 1/1] ALSA: core: Deletion of unnecessary checks before two function calls SF Markus Elfring @ 2014-11-21 18:11 ` 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 ` (11 subsequent siblings) 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-11-21 18:11 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: Julia Lawall, kernel-janitors, LKML From: Markus Elfring <elfring@users.sourceforge.net> Date: Fri, 21 Nov 2014 19:05:50 +0100 The release_and_free_resource() 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> --- sound/isa/es1688/es1688_lib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index b3b4f15..fb259491 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c @@ -614,8 +614,7 @@ static int snd_es1688_free(struct snd_es1688 *chip) { if (chip->hardware != ES1688_HW_UNDEF) snd_es1688_init(chip, 0); - if (chip->res_port) - release_and_free_resource(chip->res_port); + release_and_free_resource(chip->res_port); if (chip->irq >= 0) free_irq(chip->irq, (void *) chip); if (chip->dma8 >= 0) { -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] ALSA: es1688_lib: Deletion of an unnecessary check before the function call "release_and_free_resource" 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2014-11-21 19:08 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall At Fri, 21 Nov 2014 19:11:47 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Fri, 21 Nov 2014 19:05:50 +0100 > > The release_and_free_resource() 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> Applied, thanks. Takashi > --- > sound/isa/es1688/es1688_lib.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c > index b3b4f15..fb259491 100644 > --- a/sound/isa/es1688/es1688_lib.c > +++ b/sound/isa/es1688/es1688_lib.c > @@ -614,8 +614,7 @@ static int snd_es1688_free(struct snd_es1688 *chip) > { > if (chip->hardware != ES1688_HW_UNDEF) > snd_es1688_init(chip, 0); > - if (chip->res_port) > - release_and_free_resource(chip->res_port); > + release_and_free_resource(chip->res_port); > if (chip->irq >= 0) > free_irq(chip->irq, (void *) chip); > if (chip->dma8 >= 0) { > -- > 2.1.3 > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/1] ALSA: sb: Deletion of unnecessary checks before two function calls [not found] ` <5317A59D.4@users.sourceforge.net> ` (8 preceding siblings ...) 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 18:35 ` 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 ` (10 subsequent siblings) 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-11-21 18:35 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Fri, 21 Nov 2014 19:32:02 +0100 The functions release_and_free_resource() 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/isa/sb/emu8000_synth.c | 3 +-- sound/isa/sb/sb_common.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sound/isa/sb/emu8000_synth.c b/sound/isa/sb/emu8000_synth.c index 4e3fcfb..95b39be 100644 --- a/sound/isa/sb/emu8000_synth.c +++ b/sound/isa/sb/emu8000_synth.c @@ -105,8 +105,7 @@ static int snd_emu8000_delete_device(struct snd_seq_device *dev) snd_device_free(dev->card, hw->pcm); if (hw->emu) snd_emux_free(hw->emu); - if (hw->memhdr) - snd_util_memhdr_free(hw->memhdr); + snd_util_memhdr_free(hw->memhdr); hw->emu = NULL; hw->memhdr = NULL; return 0; diff --git a/sound/isa/sb/sb_common.c b/sound/isa/sb/sb_common.c index 3ef9906..f22b448 100644 --- a/sound/isa/sb/sb_common.c +++ b/sound/isa/sb/sb_common.c @@ -184,8 +184,7 @@ static int snd_sbdsp_probe(struct snd_sb * chip) static int snd_sbdsp_free(struct snd_sb *chip) { - if (chip->res_port) - release_and_free_resource(chip->res_port); + release_and_free_resource(chip->res_port); if (chip->irq >= 0) free_irq(chip->irq, (void *) chip); #ifdef CONFIG_ISA -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] ALSA: sb: Deletion of unnecessary checks before two function calls 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2014-11-21 19:08 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall At Fri, 21 Nov 2014 19:35:18 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Fri, 21 Nov 2014 19:32:02 +0100 > > The functions release_and_free_resource() 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> Applied, thanks. Takashi > --- > sound/isa/sb/emu8000_synth.c | 3 +-- > sound/isa/sb/sb_common.c | 3 +-- > 2 files changed, 2 insertions(+), 4 deletions(-) > > diff --git a/sound/isa/sb/emu8000_synth.c b/sound/isa/sb/emu8000_synth.c > index 4e3fcfb..95b39be 100644 > --- a/sound/isa/sb/emu8000_synth.c > +++ b/sound/isa/sb/emu8000_synth.c > @@ -105,8 +105,7 @@ static int snd_emu8000_delete_device(struct snd_seq_device *dev) > snd_device_free(dev->card, hw->pcm); > if (hw->emu) > snd_emux_free(hw->emu); > - if (hw->memhdr) > - snd_util_memhdr_free(hw->memhdr); > + snd_util_memhdr_free(hw->memhdr); > hw->emu = NULL; > hw->memhdr = NULL; > return 0; > diff --git a/sound/isa/sb/sb_common.c b/sound/isa/sb/sb_common.c > index 3ef9906..f22b448 100644 > --- a/sound/isa/sb/sb_common.c > +++ b/sound/isa/sb/sb_common.c > @@ -184,8 +184,7 @@ static int snd_sbdsp_probe(struct snd_sb * chip) > > static int snd_sbdsp_free(struct snd_sb *chip) > { > - if (chip->res_port) > - release_and_free_resource(chip->res_port); > + release_and_free_resource(chip->res_port); > if (chip->irq >= 0) > free_irq(chip->irq, (void *) chip); > #ifdef CONFIG_ISA > -- > 2.1.3 > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/1] ASoC: fsi: Deletion of unnecessary checks before the function call "clk_disable" [not found] ` <5317A59D.4@users.sourceforge.net> ` (9 preceding siblings ...) 2014-11-21 18:35 ` [PATCH 1/1] ALSA: sb: Deletion of unnecessary checks before two function calls SF Markus Elfring @ 2014-12-02 13:41 ` 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 ` (9 subsequent siblings) 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-12-02 13:41 UTC (permalink / raw) To: Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 2 Dec 2014 14:34:30 +0100 The clk_disable() 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> --- sound/soc/sh/fsi.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 88e5df4..8869971 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -842,12 +842,9 @@ static int fsi_clk_disable(struct device *dev, return -EINVAL; if (1 == clock->count--) { - if (clock->xck) - clk_disable(clock->xck); - if (clock->ick) - clk_disable(clock->ick); - if (clock->div) - clk_disable(clock->div); + clk_disable(clock->xck); + clk_disable(clock->ick); + clk_disable(clock->div); } return 0; -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] ASoC: fsi: Deletion of unnecessary checks before the function call "clk_disable" 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 0 siblings, 0 replies; 79+ messages in thread From: Mark Brown @ 2014-12-03 18:29 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, Liam Girdwood, Takashi Iwai, alsa-devel, LKML, kernel-janitors, Julia Lawall [-- Attachment #1: Type: text/plain, Size: 331 bytes --] On Tue, Dec 02, 2014 at 02:41:47PM +0100, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Tue, 2 Dec 2014 14:34:30 +0100 > > The clk_disable() function tests whether its argument is NULL and then > returns immediately. Thus the test around the call is not needed. Applied, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/1] ASoC: mop500: Deletion of unnecessary checks before the function call "of_node_put" [not found] ` <5317A59D.4@users.sourceforge.net> ` (10 preceding siblings ...) 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-02 16:40 ` 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 ` (8 subsequent siblings) 20 siblings, 2 replies; 79+ messages in thread From: SF Markus Elfring @ 2014-12-02 16:40 UTC (permalink / raw) To: Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 2 Dec 2014 17:15:11 +0100 The of_node_put() 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> --- sound/soc/ux500/mop500.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c index 7f7093b..4e0c0e5 100644 --- a/sound/soc/ux500/mop500.c +++ b/sound/soc/ux500/mop500.c @@ -63,10 +63,8 @@ static void mop500_of_node_put(void) int i; for (i = 0; i < 2; i++) { - if (mop500_dai_links[i].cpu_of_node) - of_node_put(mop500_dai_links[i].cpu_of_node); - if (mop500_dai_links[i].codec_of_node) - of_node_put(mop500_dai_links[i].codec_of_node); + of_node_put(mop500_dai_links[i].cpu_of_node); + of_node_put(mop500_dai_links[i].codec_of_node); } } -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] ASoC: mop500: Deletion of unnecessary checks before the function call "of_node_put" 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 1 sibling, 0 replies; 79+ messages in thread From: Mark Brown @ 2014-12-03 18:30 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, Liam Girdwood, Takashi Iwai, alsa-devel, LKML, kernel-janitors, Julia Lawall [-- Attachment #1: Type: text/plain, Size: 380 bytes --] On Tue, Dec 02, 2014 at 05:40:11PM +0100, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Tue, 2 Dec 2014 17:15:11 +0100 > > The of_node_put() function tests whether its argument is NULL and then > returns immediately. Thus the test around the call is not needed. This doesn't apply against current code, please check and resend. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] ASoC: mop500: Deletion of unnecessary checks before the function call "of_node_put" 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 1 sibling, 0 replies; 79+ messages in thread From: Mark Brown @ 2014-12-03 18:31 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, Liam Girdwood, Takashi Iwai, alsa-devel, LKML, kernel-janitors, Julia Lawall [-- Attachment #1: Type: text/plain, Size: 373 bytes --] On Tue, Dec 02, 2014 at 05:40:11PM +0100, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Tue, 2 Dec 2014 17:15:11 +0100 > > The of_node_put() function tests whether its argument is NULL and then > returns immediately. Thus the test around the call is not needed. Sorry, realised what the dependency was - applied, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/1] ALSA: asihpi: Deletion of an unnecessary check before the function call "vfree" [not found] ` <5317A59D.4@users.sourceforge.net> ` (11 preceding siblings ...) 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-02 17:11 ` 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 ` (7 subsequent siblings) 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-12-02 17:11 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: Julia Lawall, kernel-janitors, LKML From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 2 Dec 2014 18:05:32 +0100 The vfree() function performs also input parameter validation. 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/asihpi/hpioctl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index e457eb8..6aa677e 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c @@ -547,8 +547,7 @@ void asihpi_adapter_remove(struct pci_dev *pci_dev) if (pa->irq) free_irq(pa->irq, pa); - if (pa->p_buffer) - vfree(pa->p_buffer); + vfree(pa->p_buffer); if (1) dev_info(&pci_dev->dev, -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] ALSA: asihpi: Deletion of an unnecessary check before the function call "vfree" 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2014-12-02 17:39 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall At Tue, 02 Dec 2014 18:11:02 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Tue, 2 Dec 2014 18:05:32 +0100 > > The vfree() function performs also input parameter validation. 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> Applied, thanks. Takashi > --- > sound/pci/asihpi/hpioctl.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c > index e457eb8..6aa677e 100644 > --- a/sound/pci/asihpi/hpioctl.c > +++ b/sound/pci/asihpi/hpioctl.c > @@ -547,8 +547,7 @@ void asihpi_adapter_remove(struct pci_dev *pci_dev) > if (pa->irq) > free_irq(pa->irq, pa); > > - if (pa->p_buffer) > - vfree(pa->p_buffer); > + vfree(pa->p_buffer); > > if (1) > dev_info(&pci_dev->dev, > -- > 2.1.3 > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/1] ALSA: echoaudio: Deletion of a check before release_and_free_resource() [not found] ` <5317A59D.4@users.sourceforge.net> ` (12 preceding siblings ...) 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:38 ` 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 ` (6 subsequent siblings) 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-12-02 17:38 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 2 Dec 2014 18:34:45 +0100 The release_and_free_resource() 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> --- sound/pci/echoaudio/echoaudio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 60e4003..21228ad 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -1875,8 +1875,7 @@ static int snd_echo_free(struct echoaudio *chip) if (chip->dsp_registers) iounmap(chip->dsp_registers); - if (chip->iores) - release_and_free_resource(chip->iores); + release_and_free_resource(chip->iores); pci_disable_device(chip->pci); -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] ALSA: echoaudio: Deletion of a check before release_and_free_resource() 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2014-12-02 17:40 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall At Tue, 02 Dec 2014 18:38:25 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Tue, 2 Dec 2014 18:34:45 +0100 > > The release_and_free_resource() 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> Thanks, applied. Takashi > --- > sound/pci/echoaudio/echoaudio.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c > index 60e4003..21228ad 100644 > --- a/sound/pci/echoaudio/echoaudio.c > +++ b/sound/pci/echoaudio/echoaudio.c > @@ -1875,8 +1875,7 @@ static int snd_echo_free(struct echoaudio *chip) > if (chip->dsp_registers) > iounmap(chip->dsp_registers); > > - if (chip->iores) > - release_and_free_resource(chip->iores); > + release_and_free_resource(chip->iores); > > > pci_disable_device(chip->pci); > -- > 2.1.3 > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/1] ALSA: trident: Deletion of a check before snd_util_memhdr_free() [not found] ` <5317A59D.4@users.sourceforge.net> ` (13 preceding siblings ...) 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:56 ` 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 ` (5 subsequent siblings) 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-12-02 17:56 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 2 Dec 2014 18:52:21 +0100 The snd_util_memhdr_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> --- sound/pci/trident/trident_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index da875dc..57cd757 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c @@ -3702,8 +3702,7 @@ static int snd_trident_free(struct snd_trident *trident) free_irq(trident->irq, trident); if (trident->tlb.buffer.area) { outl(0, TRID_REG(trident, NX_TLBC)); - if (trident->tlb.memhdr) - snd_util_memhdr_free(trident->tlb.memhdr); + snd_util_memhdr_free(trident->tlb.memhdr); if (trident->tlb.silent_page.area) snd_dma_free_pages(&trident->tlb.silent_page); vfree(trident->tlb.shadow_entries); -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/1] ALSA: trident: Deletion of a check before snd_util_memhdr_free() 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2014-12-02 19:11 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall At Tue, 02 Dec 2014 18:56:30 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Tue, 2 Dec 2014 18:52:21 +0100 > > The snd_util_memhdr_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> Applied, thanks. Takashi > --- > sound/pci/trident/trident_main.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c > index da875dc..57cd757 100644 > --- a/sound/pci/trident/trident_main.c > +++ b/sound/pci/trident/trident_main.c > @@ -3702,8 +3702,7 @@ static int snd_trident_free(struct snd_trident *trident) > free_irq(trident->irq, trident); > if (trident->tlb.buffer.area) { > outl(0, TRID_REG(trident, NX_TLBC)); > - if (trident->tlb.memhdr) > - snd_util_memhdr_free(trident->tlb.memhdr); > + snd_util_memhdr_free(trident->tlb.memhdr); > if (trident->tlb.silent_page.area) > snd_dma_free_pages(&trident->tlb.silent_page); > vfree(trident->tlb.shadow_entries); > -- > 2.1.3 > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 0/2] ALSA: ctxfi: Delete an unnecessary check before kfree() [not found] ` <5317A59D.4@users.sourceforge.net> ` (14 preceding siblings ...) 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 20:50 ` 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 ` (2 more replies) 2014-12-02 21:55 ` [PATCH] ALSA: i2sbus: Deletion of unnecessary checks before the function call "release_and_free_resource" SF Markus Elfring ` (4 subsequent siblings) 20 siblings, 3 replies; 79+ messages in thread From: SF Markus Elfring @ 2014-12-02 20:50 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 2 Dec 2014 20:35:41 +0100 Another update suggestion was taken into account after a patch was applied from static source code analysis. Markus Elfring (2): Deletion of an unnecessary check before the function call "kfree" One function call less in get_daio_rsc() after error detection sound/pci/ctxfi/ctdaio.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.1.3 ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/2] ALSA: ctxfi: Deletion of an unnecessary check before the function call "kfree" 2014-12-02 20:50 ` [PATCH 0/2] ALSA: ctxfi: Delete an unnecessary check before kfree() SF Markus Elfring @ 2014-12-02 20:55 ` 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 2 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-12-02 20:55 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 2 Dec 2014 20:00:33 +0100 The kfree() function performs also input parameter validation. 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/ctxfi/ctdaio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c index c1c3f88..1712332 100644 --- a/sound/pci/ctxfi/ctdaio.c +++ b/sound/pci/ctxfi/ctdaio.c @@ -577,7 +577,7 @@ static int get_daio_rsc(struct daio_mgr *mgr, error: if (dao) kfree(dao); - else if (dai) + else kfree(dai); spin_lock_irqsave(&mgr->mgr_lock, flags); -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 1/2] ALSA: ctxfi: Deletion of an unnecessary check before the function call "kfree" 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 0 siblings, 0 replies; 79+ messages in thread From: Joe Perches @ 2014-12-02 21:07 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, LKML, kernel-janitors, Julia Lawall On Tue, 2014-12-02 at 21:55 +0100, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Tue, 2 Dec 2014 20:00:33 +0100 > > The kfree() function performs also input parameter validation. > 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/ctxfi/ctdaio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c > index c1c3f88..1712332 100644 > --- a/sound/pci/ctxfi/ctdaio.c > +++ b/sound/pci/ctxfi/ctdaio.c > @@ -577,7 +577,7 @@ static int get_daio_rsc(struct daio_mgr *mgr, > error: > if (dao) > kfree(dao); > - else if (dai) > + else > kfree(dai); > > spin_lock_irqsave(&mgr->mgr_lock, flags); I think this not nice and would prefer something like: --- sound/pci/ctxfi/ctdaio.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c index c1c3f88..9b87dd2 100644 --- a/sound/pci/ctxfi/ctdaio.c +++ b/sound/pci/ctxfi/ctdaio.c @@ -528,8 +528,6 @@ static int get_daio_rsc(struct daio_mgr *mgr, struct daio **rdaio) { int err; - struct dai *dai = NULL; - struct dao *dao = NULL; unsigned long flags; *rdaio = NULL; @@ -544,27 +542,30 @@ static int get_daio_rsc(struct daio_mgr *mgr, return err; } + err = -ENOMEM; /* Allocate mem for daio resource */ if (desc->type <= DAIO_OUT_MAX) { - dao = kzalloc(sizeof(*dao), GFP_KERNEL); - if (!dao) { - err = -ENOMEM; + struct dao *dao = kzalloc(sizeof(*dao), GFP_KERNEL); + if (!dao) goto error; - } + err = dao_rsc_init(dao, desc, mgr); - if (err) + if (err) { + kfree(dao); goto error; + } *rdaio = &dao->daio; } else { - dai = kzalloc(sizeof(*dai), GFP_KERNEL); - if (!dai) { - err = -ENOMEM; + struct dai *dai = kzalloc(sizeof(*dai), GFP_KERNEL); + if (!dai) goto error; - } + err = dai_rsc_init(dai, desc, mgr); - if (err) + if (err) { + kfree(dai); goto error; + } *rdaio = &dai->daio; } @@ -575,11 +576,6 @@ static int get_daio_rsc(struct daio_mgr *mgr, return 0; error: - if (dao) - kfree(dao); - else if (dai) - kfree(dai); - spin_lock_irqsave(&mgr->mgr_lock, flags); daio_mgr_put_rsc(&mgr->mgr, desc->type); spin_unlock_irqrestore(&mgr->mgr_lock, flags); ^ permalink raw reply related [flat|nested] 79+ messages in thread
* [PATCH 2/2] ALSA: ctxfi: One function call less in get_daio_rsc() after error detection 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:00 ` SF Markus Elfring 2014-12-03 6:51 ` [PATCH 0/2] ALSA: ctxfi: Delete an unnecessary check before kfree() Takashi Iwai 2 siblings, 0 replies; 79+ messages in thread From: SF Markus Elfring @ 2014-12-02 21:00 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 2 Dec 2014 20:33:51 +0100 The kfree() function was called in two cases by the get_daio_rsc() function during error handling even if the passed variable contained still a null pointer. This implementation detail could be improved by adjustments for jump labels. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- sound/pci/ctxfi/ctdaio.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c index 1712332..a12489e 100644 --- a/sound/pci/ctxfi/ctdaio.c +++ b/sound/pci/ctxfi/ctdaio.c @@ -549,22 +549,22 @@ static int get_daio_rsc(struct daio_mgr *mgr, dao = kzalloc(sizeof(*dao), GFP_KERNEL); if (!dao) { err = -ENOMEM; - goto error; + goto alloc_error; } err = dao_rsc_init(dao, desc, mgr); if (err) - goto error; + goto dao_init_error; *rdaio = &dao->daio; } else { dai = kzalloc(sizeof(*dai), GFP_KERNEL); if (!dai) { err = -ENOMEM; - goto error; + goto alloc_error; } err = dai_rsc_init(dai, desc, mgr); if (err) - goto error; + goto dai_init_error; *rdaio = &dai->daio; } @@ -574,12 +574,12 @@ static int get_daio_rsc(struct daio_mgr *mgr, return 0; -error: - if (dao) - kfree(dao); - else - kfree(dai); - +dao_init_error: + kfree(dao); + goto alloc_error; +dai_init_error: + kfree(dai); +alloc_error: spin_lock_irqsave(&mgr->mgr_lock, flags); daio_mgr_put_rsc(&mgr->mgr, desc->type); spin_unlock_irqrestore(&mgr->mgr_lock, flags); -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 0/2] ALSA: ctxfi: Delete an unnecessary check before kfree() 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: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 ` Takashi Iwai 2014-12-03 11:38 ` SF Markus Elfring 2 siblings, 1 reply; 79+ messages in thread From: Takashi Iwai @ 2014-12-03 6:51 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall At Tue, 02 Dec 2014 21:50:26 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Tue, 2 Dec 2014 20:35:41 +0100 > > Another update suggestion was taken into account after a patch was applied > from static source code analysis. > > Markus Elfring (2): > Deletion of an unnecessary check before the function call "kfree" > One function call less in get_daio_rsc() after error detection In these cases, the changes aren't so straightforward, and they don't improve the readability. Takashi ^ permalink raw reply [flat|nested] 79+ messages in thread
* Re: ALSA: ctxfi: Delete an unnecessary check before kfree() 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 0 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-12-03 11:38 UTC (permalink / raw) To: Takashi Iwai Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall >> Deletion of an unnecessary check before the function call "kfree" >> One function call less in get_daio_rsc() after error detection > > In these cases, the changes aren't so straightforward, and they don't > improve the readability. How do you prefer to improve the affected source code here? Regards, Markus ^ permalink raw reply [flat|nested] 79+ messages in thread
* Re: ALSA: ctxfi: Delete an unnecessary check before kfree() 2014-12-03 11:38 ` SF Markus Elfring @ 2014-12-03 12:41 ` Takashi Iwai 2014-12-03 17:14 ` Joe Perches 0 siblings, 1 reply; 79+ messages in thread From: Takashi Iwai @ 2014-12-03 12:41 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall At Wed, 03 Dec 2014 12:38:51 +0100, SF Markus Elfring wrote: > > >> Deletion of an unnecessary check before the function call "kfree" > >> One function call less in get_daio_rsc() after error detection > > > > In these cases, the changes aren't so straightforward, and they don't > > improve the readability. > > How do you prefer to improve the affected source code here? Don't touch then. There are no bugs to fix there. Takashi ^ permalink raw reply [flat|nested] 79+ messages in thread
* Re: ALSA: ctxfi: Delete an unnecessary check before kfree() 2014-12-03 12:41 ` Takashi Iwai @ 2014-12-03 17:14 ` Joe Perches 2014-12-03 17:30 ` Takashi Iwai 0 siblings, 1 reply; 79+ messages in thread From: Joe Perches @ 2014-12-03 17:14 UTC (permalink / raw) To: Takashi Iwai Cc: SF Markus Elfring, Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall On Wed, 2014-12-03 at 13:41 +0100, Takashi Iwai wrote: > At Wed, 03 Dec 2014 12:38:51 +0100, > SF Markus Elfring wrote: > > > > >> Deletion of an unnecessary check before the function call "kfree" > > >> One function call less in get_daio_rsc() after error detection > > > > > > In these cases, the changes aren't so straightforward, and they don't > > > improve the readability. > > > > How do you prefer to improve the affected source code here? > > Don't touch then. There are no bugs to fix there. Takashi, what did you think of this? https://lkml.org/lkml/2014/12/2/771 Just unnecessary? ^ permalink raw reply [flat|nested] 79+ messages in thread
* Re: ALSA: ctxfi: Delete an unnecessary check before kfree() 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 0 siblings, 1 reply; 79+ messages in thread From: Takashi Iwai @ 2014-12-03 17:30 UTC (permalink / raw) To: Joe Perches Cc: SF Markus Elfring, Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall At Wed, 03 Dec 2014 09:14:48 -0800, Joe Perches wrote: > > On Wed, 2014-12-03 at 13:41 +0100, Takashi Iwai wrote: > > At Wed, 03 Dec 2014 12:38:51 +0100, > > SF Markus Elfring wrote: > > > > > > >> Deletion of an unnecessary check before the function call "kfree" > > > >> One function call less in get_daio_rsc() after error detection > > > > > > > > In these cases, the changes aren't so straightforward, and they don't > > > > improve the readability. > > > > > > How do you prefer to improve the affected source code here? > > > > Don't touch then. There are no bugs to fix there. > > Takashi, what did you think of this? > https://lkml.org/lkml/2014/12/2/771 > > Just unnecessary? Well, this one looks more consistent. But honestly speaking, it's rather a matter of taste. So I'm not so much inclined to merge the stuff, too, sorry. If it's proven to reduce the compiled size, etc, I'll happily apply it, though. FWIW, what wasn't good in the original patch was to break the balance. It removed only the check for dai, and not for dao. One would wonder why there is a check only for one. It could be two simple kfree() calls instead. But then this won't be an improvement, as it gets one more function call, which is more expensive than a conditional. Takashi ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH] ALSA: ctxfi: Neaten get_daio_rsc 2014-12-03 17:30 ` Takashi Iwai @ 2014-12-03 17:59 ` Joe Perches 2014-12-03 19:31 ` Takashi Iwai 0 siblings, 1 reply; 79+ messages in thread From: Joe Perches @ 2014-12-03 17:59 UTC (permalink / raw) To: Takashi Iwai Cc: SF Markus Elfring, Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall Move the pointer declarations into the blocks that use them. Neaten the kfree calls when the _init functions fail. Trivially reduces object size (defconfig x86-64) $ size sound/pci/ctxfi/ctdaio.o.* text data bss dec hex filename 5287 224 0 5511 1587 sound/pci/ctxfi/ctdaio.o.new 5319 224 0 5543 15a7 sound/pci/ctxfi/ctdaio.o.old Signed-off-by: Joe Perches <joe@perches.com> Noticed-by: Markus Elfring <elfring@users.sourceforge.net> --- On Wed, 2014-12-03 at 18:30 +0100, Takashi Iwai wrote: > At Wed, 03 Dec 2014 09:14:48 -0800, Joe Perches wrote: > > On Wed, 2014-12-03 at 13:41 +0100, Takashi Iwai wrote: > > Takashi, what did you think of this? > > https://lkml.org/lkml/2014/12/2/771 > > > > Just unnecessary? > > Well, this one looks more consistent. But honestly speaking, it's > rather a matter of taste. So I'm not so much inclined to merge the > stuff, too, sorry. If it's proven to reduce the compiled size, etc, > I'll happily apply it, though. sound/pci/ctxfi/ctdaio.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c index c1c3f88..9b87dd2 100644 --- a/sound/pci/ctxfi/ctdaio.c +++ b/sound/pci/ctxfi/ctdaio.c @@ -528,8 +528,6 @@ static int get_daio_rsc(struct daio_mgr *mgr, struct daio **rdaio) { int err; - struct dai *dai = NULL; - struct dao *dao = NULL; unsigned long flags; *rdaio = NULL; @@ -544,27 +542,30 @@ static int get_daio_rsc(struct daio_mgr *mgr, return err; } + err = -ENOMEM; /* Allocate mem for daio resource */ if (desc->type <= DAIO_OUT_MAX) { - dao = kzalloc(sizeof(*dao), GFP_KERNEL); - if (!dao) { - err = -ENOMEM; + struct dao *dao = kzalloc(sizeof(*dao), GFP_KERNEL); + if (!dao) goto error; - } + err = dao_rsc_init(dao, desc, mgr); - if (err) + if (err) { + kfree(dao); goto error; + } *rdaio = &dao->daio; } else { - dai = kzalloc(sizeof(*dai), GFP_KERNEL); - if (!dai) { - err = -ENOMEM; + struct dai *dai = kzalloc(sizeof(*dai), GFP_KERNEL); + if (!dai) goto error; - } + err = dai_rsc_init(dai, desc, mgr); - if (err) + if (err) { + kfree(dai); goto error; + } *rdaio = &dai->daio; } @@ -575,11 +576,6 @@ static int get_daio_rsc(struct daio_mgr *mgr, return 0; error: - if (dao) - kfree(dao); - else if (dai) - kfree(dai); - spin_lock_irqsave(&mgr->mgr_lock, flags); daio_mgr_put_rsc(&mgr->mgr, desc->type); spin_unlock_irqrestore(&mgr->mgr_lock, flags); ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH] ALSA: ctxfi: Neaten get_daio_rsc 2014-12-03 17:59 ` [PATCH] ALSA: ctxfi: Neaten get_daio_rsc Joe Perches @ 2014-12-03 19:31 ` Takashi Iwai 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2014-12-03 19:31 UTC (permalink / raw) To: Joe Perches Cc: SF Markus Elfring, Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall At Wed, 03 Dec 2014 09:59:31 -0800, Joe Perches wrote: > > Move the pointer declarations into the blocks that use them. > Neaten the kfree calls when the _init functions fail. > > Trivially reduces object size (defconfig x86-64) > > $ size sound/pci/ctxfi/ctdaio.o.* > text data bss dec hex filename > 5287 224 0 5511 1587 sound/pci/ctxfi/ctdaio.o.new > 5319 224 0 5543 15a7 sound/pci/ctxfi/ctdaio.o.old > > Signed-off-by: Joe Perches <joe@perches.com> > Noticed-by: Markus Elfring <elfring@users.sourceforge.net> > --- > On Wed, 2014-12-03 at 18:30 +0100, Takashi Iwai wrote: > > At Wed, 03 Dec 2014 09:14:48 -0800, Joe Perches wrote: > > > On Wed, 2014-12-03 at 13:41 +0100, Takashi Iwai wrote: > > > Takashi, what did you think of this? > > > https://lkml.org/lkml/2014/12/2/771 > > > > > > Just unnecessary? > > > > Well, this one looks more consistent. But honestly speaking, it's > > rather a matter of taste. So I'm not so much inclined to merge the > > stuff, too, sorry. If it's proven to reduce the compiled size, etc, > > I'll happily apply it, though. Thanks, applied now. Takashi > > sound/pci/ctxfi/ctdaio.c | 30 +++++++++++++----------------- > 1 file changed, 13 insertions(+), 17 deletions(-) > > diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c > index c1c3f88..9b87dd2 100644 > --- a/sound/pci/ctxfi/ctdaio.c > +++ b/sound/pci/ctxfi/ctdaio.c > @@ -528,8 +528,6 @@ static int get_daio_rsc(struct daio_mgr *mgr, > struct daio **rdaio) > { > int err; > - struct dai *dai = NULL; > - struct dao *dao = NULL; > unsigned long flags; > > *rdaio = NULL; > @@ -544,27 +542,30 @@ static int get_daio_rsc(struct daio_mgr *mgr, > return err; > } > > + err = -ENOMEM; > /* Allocate mem for daio resource */ > if (desc->type <= DAIO_OUT_MAX) { > - dao = kzalloc(sizeof(*dao), GFP_KERNEL); > - if (!dao) { > - err = -ENOMEM; > + struct dao *dao = kzalloc(sizeof(*dao), GFP_KERNEL); > + if (!dao) > goto error; > - } > + > err = dao_rsc_init(dao, desc, mgr); > - if (err) > + if (err) { > + kfree(dao); > goto error; > + } > > *rdaio = &dao->daio; > } else { > - dai = kzalloc(sizeof(*dai), GFP_KERNEL); > - if (!dai) { > - err = -ENOMEM; > + struct dai *dai = kzalloc(sizeof(*dai), GFP_KERNEL); > + if (!dai) > goto error; > - } > + > err = dai_rsc_init(dai, desc, mgr); > - if (err) > + if (err) { > + kfree(dai); > goto error; > + } > > *rdaio = &dai->daio; > } > @@ -575,11 +576,6 @@ static int get_daio_rsc(struct daio_mgr *mgr, > return 0; > > error: > - if (dao) > - kfree(dao); > - else if (dai) > - kfree(dai); > - > spin_lock_irqsave(&mgr->mgr_lock, flags); > daio_mgr_put_rsc(&mgr->mgr, desc->type); > spin_unlock_irqrestore(&mgr->mgr_lock, flags); > > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH] ALSA: i2sbus: Deletion of unnecessary checks before the function call "release_and_free_resource" [not found] ` <5317A59D.4@users.sourceforge.net> ` (15 preceding siblings ...) 2014-12-02 20:50 ` [PATCH 0/2] ALSA: ctxfi: Delete an unnecessary check before kfree() SF Markus Elfring @ 2014-12-02 21:55 ` 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 ` (3 subsequent siblings) 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2014-12-02 21:55 UTC (permalink / raw) To: Jaroslav Kysela, Johannes Berg, Takashi Iwai, alsa-devel, linuxppc-dev Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Tue, 2 Dec 2014 22:50:24 +0100 The release_and_free_resource() 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> --- sound/aoa/soundbus/i2sbus/core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c index a80d5ea..4e2b4fb 100644 --- a/sound/aoa/soundbus/i2sbus/core.c +++ b/sound/aoa/soundbus/i2sbus/core.c @@ -79,8 +79,7 @@ static void i2sbus_release_dev(struct device *dev) if (i2sdev->out.dbdma) iounmap(i2sdev->out.dbdma); if (i2sdev->in.dbdma) iounmap(i2sdev->in.dbdma); for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++) - if (i2sdev->allocated_resource[i]) - release_and_free_resource(i2sdev->allocated_resource[i]); + release_and_free_resource(i2sdev->allocated_resource[i]); free_dbdma_descriptor_ring(i2sdev, &i2sdev->out.dbdma_ring); free_dbdma_descriptor_ring(i2sdev, &i2sdev->in.dbdma_ring); for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++) @@ -323,8 +322,7 @@ static int i2sbus_add_dev(struct macio_dev *macio, if (dev->out.dbdma) iounmap(dev->out.dbdma); if (dev->in.dbdma) iounmap(dev->in.dbdma); for (i=0;i<3;i++) - if (dev->allocated_resource[i]) - release_and_free_resource(dev->allocated_resource[i]); + release_and_free_resource(dev->allocated_resource[i]); mutex_destroy(&dev->lock); kfree(dev); return 0; -- 2.1.3 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH] ALSA: i2sbus: Deletion of unnecessary checks before the function call "release_and_free_resource" 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2014-12-03 6:59 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, Johannes Berg, alsa-devel, linuxppc-dev, LKML, kernel-janitors, Julia Lawall At Tue, 02 Dec 2014 22:55:57 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Tue, 2 Dec 2014 22:50:24 +0100 > > The release_and_free_resource() 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> Thanks, applied. Takashi > --- > sound/aoa/soundbus/i2sbus/core.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c > index a80d5ea..4e2b4fb 100644 > --- a/sound/aoa/soundbus/i2sbus/core.c > +++ b/sound/aoa/soundbus/i2sbus/core.c > @@ -79,8 +79,7 @@ static void i2sbus_release_dev(struct device *dev) > if (i2sdev->out.dbdma) iounmap(i2sdev->out.dbdma); > if (i2sdev->in.dbdma) iounmap(i2sdev->in.dbdma); > for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++) > - if (i2sdev->allocated_resource[i]) > - release_and_free_resource(i2sdev->allocated_resource[i]); > + release_and_free_resource(i2sdev->allocated_resource[i]); > free_dbdma_descriptor_ring(i2sdev, &i2sdev->out.dbdma_ring); > free_dbdma_descriptor_ring(i2sdev, &i2sdev->in.dbdma_ring); > for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++) > @@ -323,8 +322,7 @@ static int i2sbus_add_dev(struct macio_dev *macio, > if (dev->out.dbdma) iounmap(dev->out.dbdma); > if (dev->in.dbdma) iounmap(dev->in.dbdma); > for (i=0;i<3;i++) > - if (dev->allocated_resource[i]) > - release_and_free_resource(dev->allocated_resource[i]); > + release_and_free_resource(dev->allocated_resource[i]); > mutex_destroy(&dev->lock); > kfree(dev); > return 0; > -- > 2.1.3 > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 0/13] ALSA: Deletion of some unnecessary checks [not found] ` <5317A59D.4@users.sourceforge.net> ` (16 preceding siblings ...) 2014-12-02 21:55 ` [PATCH] ALSA: i2sbus: Deletion of unnecessary checks before the function call "release_and_free_resource" SF Markus Elfring @ 2015-01-04 12:43 ` 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 ` (13 more replies) 2015-06-28 9:21 ` [PATCH] ALSA: hda: Delete an unnecessary check before the function call "snd_info_free_entry" SF Markus Elfring ` (2 subsequent siblings) 20 siblings, 14 replies; 79+ messages in thread From: SF Markus Elfring @ 2015-01-04 12:43 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Sun, 4 Jan 2015 11:50:12 +0100 Further update suggestions were taken into account after several patches were applied from static source code analysis. Markus Elfring (3): seq: Deletion of unnecessary checks before the function call "snd_midi_event_free" oss: Deletion of unnecessary checks before the function call "vfree" emu10k1: Delete an unnecessary check before the function call "kfree" oxygen: Delete an unnecessary check before the function call "snd_pcm_suspend" emux: Delete an unnecessary check before the function call "snd_sf_free" ASoC: Intel: Delete an unnecessary check before the function call "sst_dma_free" ASoC: fsi: Deletion of unnecessary checks before the function call "clk_enable" ASoC: Intel: Delete an unnecessary check before the function call "release_firmware" i2sbus: Delete an unnecessary check before the function call "snd_pcm_suspend_all" sb: Delete an unnecessary check before the function call "snd_emux_free" Deletion of checks before the function call "iounmap" msnd: One function call less in snd_msnd_attach() after error detection msnd: Fix centralized exiting from snd_msnd_attach() sound/aoa/soundbus/i2sbus/core.c | 13 ++++++------- sound/arm/aaci.c | 4 ++-- sound/drivers/ml403-ac97cr.c | 3 +-- sound/isa/msnd/msnd_pinnacle.c | 31 ++++++++++++++++--------------- sound/parisc/harmony.c | 4 +--- sound/pci/ad1889.c | 5 +---- sound/pci/asihpi/hpioctl.c | 6 ++---- sound/pci/atiixp.c | 3 +-- sound/pci/atiixp_modem.c | 3 +-- sound/pci/aw2/aw2-alsa.c | 4 +--- sound/pci/bt87x.c | 3 +-- sound/pci/cs4281.c | 6 ++---- sound/pci/cs46xx/cs46xx_lib.c | 4 ++-- sound/pci/ctxfi/cthw20k1.c | 5 +---- sound/pci/ctxfi/cthw20k2.c | 5 +---- sound/pci/echoaudio/echoaudio.c | 6 +----- sound/pci/hda/hda_intel.c | 3 +-- sound/pci/lola/lola.c | 6 ++---- sound/pci/mixart/mixart.c | 7 +++---- sound/pci/nm256/nm256.c | 6 ++---- sound/pci/rme9652/hdsp.c | 4 +--- sound/pci/rme9652/hdspm.c | 4 +--- sound/pci/rme9652/rme9652.c | 3 +-- sound/pci/sis7019.c | 5 +---- sound/pci/ymfpci/ymfpci_main.c | 3 +-- sound/ppc/pmac.c | 15 +++++---------- 26 files changed, 58 insertions(+), 103 deletions(-) -- 2.2.1 ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 1/13] ALSA: seq: Deletion of unnecessary checks before the function call "snd_midi_event_free" 2015-01-04 12:43 ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks SF Markus Elfring @ 2015-01-04 12:50 ` 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 ` (12 subsequent siblings) 13 siblings, 0 replies; 79+ messages in thread From: SF Markus Elfring @ 2015-01-04 12:50 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 3 Jan 2015 14:54:56 +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> --- sound/core/seq/oss/seq_oss_midi.c | 6 ++---- sound/core/seq/seq_midi.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c index 3a45696..e79cc44 100644 --- a/sound/core/seq/oss/seq_oss_midi.c +++ b/sound/core/seq/oss/seq_oss_midi.c @@ -237,8 +237,7 @@ snd_seq_oss_midi_check_exit_port(int client, int port) spin_unlock_irqrestore(®ister_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(®ister_lock, flags); @@ -265,8 +264,7 @@ snd_seq_oss_midi_clear_all(void) spin_lock_irqsave(®ister_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; } diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c index a1fd77a..68fec77 100644 --- a/sound/core/seq/seq_midi.c +++ b/sound/core/seq/seq_midi.c @@ -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 */ -- 2.2.1 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* [PATCH 2/13] ALSA: oss: Deletion of unnecessary checks before the function call "vfree" 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 ` 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 ` (11 subsequent siblings) 13 siblings, 0 replies; 79+ messages in thread From: SF Markus Elfring @ 2015-01-04 12:53 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: Julia Lawall, kernel-janitors, LKML From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 3 Jan 2015 15:10:52 +0100 The vfree() function performs also input parameter validation. 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/oss/pss.c | 2 +- sound/oss/trix.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/oss/pss.c b/sound/oss/pss.c index ca0d6e9..81314f9 100644 --- a/sound/oss/pss.c +++ b/sound/oss/pss.c @@ -1228,7 +1228,7 @@ static void __exit cleanup_pss(void) { if(!pss_no_sound) { - if(fw_load && pss_synth) + if (fw_load) vfree(pss_synth); if(pssmss) unload_pss_mss(&cfg2); diff --git a/sound/oss/trix.c b/sound/oss/trix.c index 944e0c0..3c494dc 100644 --- a/sound/oss/trix.c +++ b/sound/oss/trix.c @@ -487,7 +487,7 @@ static int __init init_trix(void) static void __exit cleanup_trix(void) { - if (fw_load && trix_boot) + if (fw_load) vfree(trix_boot); if (sb) unload_trix_sb(&cfg2); -- 2.2.1 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* [PATCH 3/13] ALSA: emu10k1: Delete an unnecessary check before the function call "kfree" 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 ` 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 ` (10 subsequent siblings) 13 siblings, 0 replies; 79+ messages in thread From: SF Markus Elfring @ 2015-01-04 12:55 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 3 Jan 2015 17:06:04 +0100 The kfree() 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> --- sound/pci/emu10k1/p16v.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c index b672755..3c60b43 100644 --- a/sound/pci/emu10k1/p16v.c +++ b/sound/pci/emu10k1/p16v.c @@ -166,11 +166,8 @@ static struct snd_pcm_hardware snd_p16v_capture_hw = { static void snd_p16v_pcm_free_substream(struct snd_pcm_runtime *runtime) { struct snd_emu10k1_pcm *epcm = runtime->private_data; - - if (epcm) { - /* dev_dbg(emu->card->dev, "epcm free: %p\n", epcm); */ - kfree(epcm); - } + + kfree(epcm); } /* open_playback callback */ -- 2.2.1 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* [PATCH 4/13] ALSA: oxygen: Delete an unnecessary check before the function call "snd_pcm_suspend" 2015-01-04 12:43 ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks SF Markus Elfring ` (2 preceding siblings ...) 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 ` 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 ` (9 subsequent siblings) 13 siblings, 0 replies; 79+ messages in thread From: SF Markus Elfring @ 2015-01-04 13:00 UTC (permalink / raw) To: Clemens Ladisch, Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: Julia Lawall, kernel-janitors, LKML From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 3 Jan 2015 17:37:28 +0100 The snd_pcm_suspend() 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> --- sound/pci/oxygen/oxygen_lib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index b67e306..61a62c0 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c @@ -736,8 +736,7 @@ static int oxygen_pci_suspend(struct device *dev) snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); for (i = 0; i < PCM_COUNT; ++i) - if (chip->streams[i]) - snd_pcm_suspend(chip->streams[i]); + snd_pcm_suspend(chip->streams[i]); if (chip->model.suspend) chip->model.suspend(chip); -- 2.2.1 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* [PATCH 5/13] ALSA: emux: Delete an unnecessary check before the function call "snd_sf_free" 2015-01-04 12:43 ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks SF Markus Elfring ` (3 preceding siblings ...) 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 ` 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 ` (8 subsequent siblings) 13 siblings, 0 replies; 79+ messages in thread From: SF Markus Elfring @ 2015-01-04 13:02 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 3 Jan 2015 18:28:21 +0100 The snd_sf_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> --- sound/synth/emux/emux.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c index 9352207..f27a1c8 100644 --- a/sound/synth/emux/emux.c +++ b/sound/synth/emux/emux.c @@ -160,12 +160,8 @@ int snd_emux_free(struct snd_emux *emu) snd_emux_detach_seq_oss(emu); #endif snd_emux_detach_seq(emu); - snd_emux_delete_hwdep(emu); - - if (emu->sflist) - snd_sf_free(emu->sflist); - + snd_sf_free(emu->sflist); kfree(emu->voices); kfree(emu->name); kfree(emu); -- 2.2.1 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* [PATCH 6/13] ASoC: Intel: Delete an unnecessary check before the function call "sst_dma_free" 2015-01-04 12:43 ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks SF Markus Elfring ` (4 preceding siblings ...) 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 ` SF Markus Elfring 2015-01-05 14:35 ` 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 ` (7 subsequent siblings) 13 siblings, 2 replies; 79+ messages in thread From: SF Markus Elfring @ 2015-01-04 13:08 UTC (permalink / raw) To: Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai, alsa-devel Cc: Julia Lawall, kernel-janitors, LKML From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 3 Jan 2015 19:03:55 +0100 The sst_dma_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> --- sound/soc/intel/sst-dsp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/intel/sst-dsp.c b/sound/soc/intel/sst-dsp.c index 86e4108..64e9421 100644 --- a/sound/soc/intel/sst-dsp.c +++ b/sound/soc/intel/sst-dsp.c @@ -410,8 +410,7 @@ void sst_dsp_free(struct sst_dsp *sst) if (sst->ops->free) sst->ops->free(sst); - if (sst->dma) - sst_dma_free(sst->dma); + sst_dma_free(sst->dma); } EXPORT_SYMBOL_GPL(sst_dsp_free); -- 2.2.1 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 6/13] ASoC: Intel: Delete an unnecessary check before the function call "sst_dma_free" 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 19:02 ` Mark Brown 1 sibling, 1 reply; 79+ messages in thread From: Mark Brown @ 2015-01-05 14:35 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, Liam Girdwood, Takashi Iwai, alsa-devel, LKML, kernel-janitors, Julia Lawall [-- Attachment #1: Type: text/plain, Size: 368 bytes --] On Sun, Jan 04, 2015 at 02:08:42PM +0100, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sat, 3 Jan 2015 19:03:55 +0100 > > The sst_dma_free() function tests whether its argument is NULL and then > returns immediately. Thus the test around the call is not needed. I'm missing aptches 1-5, are there any dependencies? [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 79+ messages in thread
* Re: [PATCH 6/13] ASoC: Intel: Delete an unnecessary check before the function call "sst_dma_free" 2015-01-05 14:35 ` Mark Brown @ 2015-01-05 15:18 ` Takashi Iwai 2015-01-05 18:22 ` Mark Brown 0 siblings, 1 reply; 79+ messages in thread From: Takashi Iwai @ 2015-01-05 15:18 UTC (permalink / raw) To: Mark Brown Cc: SF Markus Elfring, Jaroslav Kysela, Liam Girdwood, alsa-devel, LKML, kernel-janitors, Julia Lawall At Mon, 5 Jan 2015 14:35:51 +0000, Mark Brown wrote: > > On Sun, Jan 04, 2015 at 02:08:42PM +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > > Date: Sat, 3 Jan 2015 19:03:55 +0100 > > > > The sst_dma_free() function tests whether its argument is NULL and then > > returns immediately. Thus the test around the call is not needed. > > I'm missing aptches 1-5, are there any dependencies? No, all individual fixes. Takashi ^ permalink raw reply [flat|nested] 79+ messages in thread
* Re: [PATCH 6/13] ASoC: Intel: Delete an unnecessary check before the function call "sst_dma_free" 2015-01-05 15:18 ` Takashi Iwai @ 2015-01-05 18:22 ` Mark Brown 0 siblings, 0 replies; 79+ messages in thread From: Mark Brown @ 2015-01-05 18:22 UTC (permalink / raw) To: Takashi Iwai Cc: alsa-devel, kernel-janitors, Liam Girdwood, LKML, Julia Lawall, SF Markus Elfring [-- Attachment #1.1: Type: text/plain, Size: 306 bytes --] On Mon, Jan 05, 2015 at 04:18:07PM +0100, Takashi Iwai wrote: > Mark Brown wrote: > > I'm missing aptches 1-5, are there any dependencies? > No, all individual fixes. OK. SF, in future please always send at least the cover letter to everyone getting patches in the series so they know what's going on. [-- Attachment #1.2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] [-- Attachment #2: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply [flat|nested] 79+ messages in thread
* Re: [PATCH 6/13] ASoC: Intel: Delete an unnecessary check before the function call "sst_dma_free" 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 19:02 ` Mark Brown 1 sibling, 0 replies; 79+ messages in thread From: Mark Brown @ 2015-01-05 19:02 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, Liam Girdwood, Takashi Iwai, alsa-devel, LKML, kernel-janitors, Julia Lawall [-- Attachment #1: Type: text/plain, Size: 332 bytes --] On Sun, Jan 04, 2015 at 02:08:42PM +0100, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sat, 3 Jan 2015 19:03:55 +0100 > > The sst_dma_free() function tests whether its argument is NULL and then > returns immediately. Thus the test around the call is not needed. Applied, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 7/13] ASoC: fsi: Deletion of unnecessary checks before the function call "clk_enable" 2015-01-04 12:43 ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks SF Markus Elfring ` (5 preceding siblings ...) 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-04 13:11 ` 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 ` (6 subsequent siblings) 13 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2015-01-04 13:11 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel, Liam Girdwood, Mark Brown Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 3 Jan 2015 19:25:55 +0100 The clk_enable() 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> --- sound/soc/sh/fsi.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 8869971..d49f25f 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -820,12 +820,9 @@ static int fsi_clk_enable(struct device *dev, return ret; } - if (clock->xck) - clk_enable(clock->xck); - if (clock->ick) - clk_enable(clock->ick); - if (clock->div) - clk_enable(clock->div); + clk_enable(clock->xck); + clk_enable(clock->ick); + clk_enable(clock->div); clock->count++; } -- 2.2.1 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 7/13] ASoC: fsi: Deletion of unnecessary checks before the function call "clk_enable" 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 0 siblings, 0 replies; 79+ messages in thread From: Mark Brown @ 2015-01-05 19:03 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, Liam Girdwood, LKML, kernel-janitors, Julia Lawall [-- Attachment #1: Type: text/plain, Size: 330 bytes --] On Sun, Jan 04, 2015 at 02:11:58PM +0100, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sat, 3 Jan 2015 19:25:55 +0100 > > The clk_enable() function tests whether its argument is NULL and then > returns immediately. Thus the test around the call is not needed. Applied, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 8/13] ASoC: Intel: Delete an unnecessary check before the function call "release_firmware" 2015-01-04 12:43 ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks SF Markus Elfring ` (6 preceding siblings ...) 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-04 13:14 ` 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 ` (5 subsequent siblings) 13 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2015-01-04 13:14 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel, Liam Girdwood, Mark Brown Cc: Julia Lawall, kernel-janitors, LKML From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 3 Jan 2015 19:49:37 +0100 The release_firmware() 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> --- sound/soc/intel/sst/sst_loader.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/intel/sst/sst_loader.c b/sound/soc/intel/sst/sst_loader.c index b580f96..7888cd7 100644 --- a/sound/soc/intel/sst/sst_loader.c +++ b/sound/soc/intel/sst/sst_loader.c @@ -324,8 +324,7 @@ void sst_firmware_load_cb(const struct firmware *fw, void *context) if (ctx->sst_state != SST_RESET || ctx->fw_in_mem != NULL) { - if (fw != NULL) - release_firmware(fw); + release_firmware(fw); mutex_unlock(&ctx->sst_lock); return; } -- 2.2.1 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 8/13] ASoC: Intel: Delete an unnecessary check before the function call "release_firmware" 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 0 siblings, 0 replies; 79+ messages in thread From: Mark Brown @ 2015-01-05 19:03 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, Liam Girdwood, LKML, kernel-janitors, Julia Lawall [-- Attachment #1: Type: text/plain, Size: 336 bytes --] On Sun, Jan 04, 2015 at 02:14:37PM +0100, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sat, 3 Jan 2015 19:49:37 +0100 > > The release_firmware() function tests whether its argument is NULL and then > returns immediately. Thus the test around the call is not needed. Applied, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 9/13] ALSA: i2sbus: Delete an unnecessary check before the function call "snd_pcm_suspend_all" 2015-01-04 12:43 ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks SF Markus Elfring ` (7 preceding siblings ...) 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-04 13:21 ` 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 ` (4 subsequent siblings) 13 siblings, 0 replies; 79+ messages in thread From: SF Markus Elfring @ 2015-01-04 13:21 UTC (permalink / raw) To: Jaroslav Kysela, Johannes Berg, Takashi Iwai, alsa-devel, linuxppc-dev Cc: Julia Lawall, kernel-janitors, LKML From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 3 Jan 2015 20:43:01 +0100 The snd_pcm_suspend_all() 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> --- sound/aoa/soundbus/i2sbus/core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c index 4e2b4fb..837ba99 100644 --- a/sound/aoa/soundbus/i2sbus/core.c +++ b/sound/aoa/soundbus/i2sbus/core.c @@ -381,10 +381,8 @@ static int i2sbus_suspend(struct macio_dev* dev, pm_message_t state) list_for_each_entry(i2sdev, &control->list, item) { /* Notify Alsa */ - if (i2sdev->sound.pcm) { - /* Suspend PCM streams */ - snd_pcm_suspend_all(i2sdev->sound.pcm); - } + /* Suspend PCM streams */ + snd_pcm_suspend_all(i2sdev->sound.pcm); /* Notify codecs */ list_for_each_entry(cii, &i2sdev->sound.codec_list, list) { -- 2.2.1 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* [PATCH 10/13] ALSA: sb: Delete an unnecessary check before the function call "snd_emux_free" 2015-01-04 12:43 ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks SF Markus Elfring ` (8 preceding siblings ...) 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 ` SF Markus Elfring 2015-01-04 13:36 ` [PATCH 11/13] ALSA: Deletion of checks before the function call "iounmap" SF Markus Elfring ` (3 subsequent siblings) 13 siblings, 0 replies; 79+ messages in thread From: SF Markus Elfring @ 2015-01-04 13:28 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: Julia Lawall, kernel-janitors, LKML From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 3 Jan 2015 21:02:32 +0100 The snd_emux_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> --- sound/isa/sb/emu8000_synth.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/isa/sb/emu8000_synth.c b/sound/isa/sb/emu8000_synth.c index 95b39be..72332df 100644 --- a/sound/isa/sb/emu8000_synth.c +++ b/sound/isa/sb/emu8000_synth.c @@ -103,8 +103,7 @@ static int snd_emu8000_delete_device(struct snd_seq_device *dev) hw = dev->driver_data; if (hw->pcm) snd_device_free(dev->card, hw->pcm); - if (hw->emu) - snd_emux_free(hw->emu); + snd_emux_free(hw->emu); snd_util_memhdr_free(hw->memhdr); hw->emu = NULL; hw->memhdr = NULL; -- 2.2.1 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* [PATCH 11/13] ALSA: Deletion of checks before the function call "iounmap" 2015-01-04 12:43 ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks SF Markus Elfring ` (9 preceding siblings ...) 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 ` SF Markus Elfring 2015-01-05 13:58 ` Dan Carpenter 2016-10-26 12:26 ` 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 ` (2 subsequent siblings) 13 siblings, 2 replies; 79+ messages in thread From: SF Markus Elfring @ 2015-01-04 13:36 UTC (permalink / raw) To: Jaroslav Kysela, Johannes Berg, Clemens Ladisch, Russell King, Takashi Iwai, Thibaut Varene, alsa-devel, linuxppc-dev, linux-parisc Cc: Julia Lawall, kernel-janitors, LKML From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 3 Jan 2015 22:55:54 +0100 The iounmap() function performs also input parameter validation. 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/aoa/soundbus/i2sbus/core.c | 13 ++++++------- sound/arm/aaci.c | 4 ++-- sound/drivers/ml403-ac97cr.c | 3 +-- sound/isa/msnd/msnd_pinnacle.c | 3 +-- sound/parisc/harmony.c | 4 +--- sound/pci/ad1889.c | 5 +---- sound/pci/asihpi/hpioctl.c | 6 ++---- sound/pci/atiixp.c | 3 +-- sound/pci/atiixp_modem.c | 3 +-- sound/pci/aw2/aw2-alsa.c | 4 +--- sound/pci/bt87x.c | 3 +-- sound/pci/cs4281.c | 6 ++---- sound/pci/cs46xx/cs46xx_lib.c | 4 ++-- sound/pci/ctxfi/cthw20k1.c | 5 +---- sound/pci/ctxfi/cthw20k2.c | 5 +---- sound/pci/echoaudio/echoaudio.c | 6 +----- sound/pci/hda/hda_intel.c | 3 +-- sound/pci/lola/lola.c | 6 ++---- sound/pci/mixart/mixart.c | 7 +++---- sound/pci/nm256/nm256.c | 6 ++---- sound/pci/rme9652/hdsp.c | 4 +--- sound/pci/rme9652/hdspm.c | 4 +--- sound/pci/rme9652/rme9652.c | 3 +-- sound/pci/sis7019.c | 5 +---- sound/pci/ymfpci/ymfpci_main.c | 3 +-- sound/ppc/pmac.c | 15 +++++---------- 26 files changed, 43 insertions(+), 90 deletions(-) diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c index 4e2b4fb..7835045 100644 --- a/sound/aoa/soundbus/i2sbus/core.c +++ b/sound/aoa/soundbus/i2sbus/core.c @@ -74,10 +74,9 @@ static void i2sbus_release_dev(struct device *dev) int i; i2sdev = container_of(dev, struct i2sbus_dev, sound.ofdev.dev); - - if (i2sdev->intfregs) iounmap(i2sdev->intfregs); - if (i2sdev->out.dbdma) iounmap(i2sdev->out.dbdma); - if (i2sdev->in.dbdma) iounmap(i2sdev->in.dbdma); + iounmap(i2sdev->intfregs); + iounmap(i2sdev->out.dbdma); + iounmap(i2sdev->in.dbdma); for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++) release_and_free_resource(i2sdev->allocated_resource[i]); free_dbdma_descriptor_ring(i2sdev, &i2sdev->out.dbdma_ring); @@ -318,9 +317,9 @@ static int i2sbus_add_dev(struct macio_dev *macio, free_irq(dev->interrupts[i], dev); free_dbdma_descriptor_ring(dev, &dev->out.dbdma_ring); free_dbdma_descriptor_ring(dev, &dev->in.dbdma_ring); - if (dev->intfregs) iounmap(dev->intfregs); - if (dev->out.dbdma) iounmap(dev->out.dbdma); - if (dev->in.dbdma) iounmap(dev->in.dbdma); + iounmap(dev->intfregs); + iounmap(dev->out.dbdma); + iounmap(dev->in.dbdma); for (i=0;i<3;i++) release_and_free_resource(dev->allocated_resource[i]); mutex_destroy(&dev->lock); diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 0e83a73..4140b1b 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c @@ -889,8 +889,8 @@ static int aaci_probe_ac97(struct aaci *aaci) static void aaci_free_card(struct snd_card *card) { struct aaci *aaci = card->private_data; - if (aaci->base) - iounmap(aaci->base); + + iounmap(aaci->base); } static struct aaci *aaci_init_card(struct amba_device *dev) diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c index ec01de1..bdcb572 100644 --- a/sound/drivers/ml403-ac97cr.c +++ b/sound/drivers/ml403-ac97cr.c @@ -1094,8 +1094,7 @@ static int snd_ml403_ac97cr_free(struct snd_ml403_ac97cr *ml403_ac97cr) if (ml403_ac97cr->capture_irq >= 0) free_irq(ml403_ac97cr->capture_irq, ml403_ac97cr); /* give back "port" */ - if (ml403_ac97cr->port != NULL) - iounmap(ml403_ac97cr->port); + iounmap(ml403_ac97cr->port); kfree(ml403_ac97cr); PDEBUG(INIT_INFO, "free(): (done)\n"); return 0; diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c index 65b3682..4c07266 100644 --- a/sound/isa/msnd/msnd_pinnacle.c +++ b/sound/isa/msnd/msnd_pinnacle.c @@ -627,8 +627,7 @@ static int snd_msnd_attach(struct snd_card *card) return 0; err_release_region: - if (chip->mappedbase) - iounmap(chip->mappedbase); + iounmap(chip->mappedbase); release_mem_region(chip->base, BUFFSIZE); release_region(chip->io, DSP_NUMIO); free_irq(chip->irq, chip); diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index 29604a2..f2350c1 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c @@ -893,9 +893,7 @@ snd_harmony_free(struct snd_harmony *h) if (h->irq >= 0) free_irq(h->irq, h); - if (h->iobase) - iounmap(h->iobase); - + iounmap(h->iobase); kfree(h); return 0; } diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index 547ee30..0de3129 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c @@ -853,12 +853,9 @@ snd_ad1889_free(struct snd_ad1889 *chip) free_irq(chip->irq, chip); skip_hw: - if (chip->iobase) - iounmap(chip->iobase); - + iounmap(chip->iobase); pci_release_regions(chip->pci); pci_disable_device(chip->pci); - kfree(chip); return 0; } diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index 72af66b..67d1133 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c @@ -541,10 +541,8 @@ void asihpi_adapter_remove(struct pci_dev *pci_dev) hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL); /* unmap PCI memory space, mapped during device init. */ - for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) { - if (pci.ap_mem_base[idx]) - iounmap(pci.ap_mem_base[idx]); - } + for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; ++idx) + iounmap(pci.ap_mem_base[idx]); if (pa->irq) free_irq(pa->irq, pa); diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 9c1c445..d24188f 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c @@ -1585,8 +1585,7 @@ static int snd_atiixp_free(struct atiixp *chip) __hw_end: if (chip->irq >= 0) free_irq(chip->irq, chip); - if (chip->remap_addr) - iounmap(chip->remap_addr); + iounmap(chip->remap_addr); pci_release_regions(chip->pci); pci_disable_device(chip->pci); kfree(chip); diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index b2f63e0..c321a97 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c @@ -1211,8 +1211,7 @@ static int snd_atiixp_free(struct atiixp_modem *chip) __hw_end: if (chip->irq >= 0) free_irq(chip->irq, chip); - if (chip->remap_addr) - iounmap(chip->remap_addr); + iounmap(chip->remap_addr); pci_release_regions(chip->pci); pci_disable_device(chip->pci); kfree(chip); diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c index e1cf019..8d2fee7 100644 --- a/sound/pci/aw2/aw2-alsa.c +++ b/sound/pci/aw2/aw2-alsa.c @@ -229,9 +229,7 @@ static int snd_aw2_dev_free(struct snd_device *device) if (chip->irq >= 0) free_irq(chip->irq, (void *)chip); /* release the i/o ports & memory */ - if (chip->iobase_virt) - iounmap(chip->iobase_virt); - + iounmap(chip->iobase_virt); pci_release_regions(chip->pci); /* disable the PCI entry */ pci_disable_device(chip->pci); diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 058b997..e82ceac 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c @@ -690,8 +690,7 @@ static int snd_bt87x_free(struct snd_bt87x *chip) snd_bt87x_stop(chip); if (chip->irq >= 0) free_irq(chip->irq, chip); - if (chip->mmio) - iounmap(chip->mmio); + iounmap(chip->mmio); pci_release_regions(chip->pci); pci_disable_device(chip->pci); kfree(chip); diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index 05a4337..ea33911 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c @@ -1316,10 +1316,8 @@ static int snd_cs4281_free(struct cs4281 *chip) if (chip->irq >= 0) free_irq(chip->irq, chip); - if (chip->ba0) - iounmap(chip->ba0); - if (chip->ba1) - iounmap(chip->ba1); + iounmap(chip->ba0); + iounmap(chip->ba1); pci_release_regions(chip->pci); pci_disable_device(chip->pci); diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index dfec84e..128bbfe 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c @@ -2949,8 +2949,8 @@ static int snd_cs46xx_free(struct snd_cs46xx *chip) for (idx = 0; idx < 5; idx++) { struct snd_cs46xx_region *region = &chip->region.idx[idx]; - if (region->remap_addr) - iounmap(region->remap_addr); + + iounmap(region->remap_addr); release_and_free_resource(region->resource); } diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c index b425aa8..b8b0d8e 100644 --- a/sound/pci/ctxfi/cthw20k1.c +++ b/sound/pci/ctxfi/cthw20k1.c @@ -1985,10 +1985,7 @@ static int hw_card_shutdown(struct hw *hw) free_irq(hw->irq, hw); hw->irq = -1; - - if (hw->mem_base) - iounmap(hw->mem_base); - + iounmap(hw->mem_base); hw->mem_base = NULL; if (hw->io_base) diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c index 253899d..4e16b4d 100644 --- a/sound/pci/ctxfi/cthw20k2.c +++ b/sound/pci/ctxfi/cthw20k2.c @@ -2110,10 +2110,7 @@ static int hw_card_shutdown(struct hw *hw) free_irq(hw->irq, hw); hw->irq = -1; - - if (hw->mem_base) - iounmap(hw->mem_base); - + iounmap(hw->mem_base); hw->mem_base = NULL; if (hw->io_base) diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 21228ad..98d4f35 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -1872,12 +1872,8 @@ static int snd_echo_free(struct echoaudio *chip) if (chip->comm_page) snd_dma_free_pages(&chip->commpage_dma_buf); - if (chip->dsp_registers) - iounmap(chip->dsp_registers); - + iounmap(chip->dsp_registers); release_and_free_resource(chip->iores); - - pci_disable_device(chip->pci); /* release chip data */ diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index d426a0b..a971425 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1138,8 +1138,7 @@ static int azx_free(struct azx *chip) free_irq(chip->irq, (void*)chip); if (chip->msi) pci_disable_msi(chip->pci); - if (chip->remap_addr) - iounmap(chip->remap_addr); + iounmap(chip->remap_addr); azx_free_stream_pages(chip); if (chip->region_requested) diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c index 4cf4be5..9ff60008 100644 --- a/sound/pci/lola/lola.c +++ b/sound/pci/lola/lola.c @@ -551,10 +551,8 @@ static void lola_free(struct lola *chip) lola_free_mixer(chip); if (chip->irq >= 0) free_irq(chip->irq, (void *)chip); - if (chip->bar[0].remap_addr) - iounmap(chip->bar[0].remap_addr); - if (chip->bar[1].remap_addr) - iounmap(chip->bar[1].remap_addr); + iounmap(chip->bar[0].remap_addr); + iounmap(chip->bar[1].remap_addr); if (chip->rb.area) snd_dma_free_pages(&chip->rb); pci_release_regions(chip->pci); diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 1faf47e..c3a9f39 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -1114,10 +1114,9 @@ static int snd_mixart_free(struct mixart_mgr *mgr) } /* release the i/o ports */ - for (i = 0; i < 2; i++) { - if (mgr->mem[i].virt) - iounmap(mgr->mem[i].virt); - } + for (i = 0; i < 2; ++i) + iounmap(mgr->mem[i].virt); + pci_release_regions(mgr->pci); /* free flowarray */ diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 4e41a4e..3f52a44 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c @@ -1460,10 +1460,8 @@ static int snd_nm256_free(struct nm256 *chip) if (chip->irq >= 0) free_irq(chip->irq, chip); - if (chip->cport) - iounmap(chip->cport); - if (chip->buffer) - iounmap(chip->buffer); + iounmap(chip->cport); + iounmap(chip->buffer); release_and_free_resource(chip->res_cport); release_and_free_resource(chip->res_buffer); diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index cf5a6c8..fe66bcb 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -5309,9 +5309,7 @@ static int snd_hdsp_free(struct hdsp *hdsp) release_firmware(hdsp->firmware); vfree(hdsp->fw_uploaded); - - if (hdsp->iobase) - iounmap(hdsp->iobase); + iounmap(hdsp->iobase); if (hdsp->port) pci_release_regions(hdsp->pci); diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 3342705..8109b8e 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -6965,9 +6965,7 @@ static int snd_hdspm_free(struct hdspm * hdspm) free_irq(hdspm->irq, (void *) hdspm); kfree(hdspm->mixer); - - if (hdspm->iobase) - iounmap(hdspm->iobase); + iounmap(hdspm->iobase); if (hdspm->port) pci_release_regions(hdspm->pci); diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 6521521..648911c 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c @@ -1756,8 +1756,7 @@ static int snd_rme9652_free(struct snd_rme9652 *rme9652) if (rme9652->irq >= 0) free_irq(rme9652->irq, (void *)rme9652); - if (rme9652->iobase) - iounmap(rme9652->iobase); + iounmap(rme9652->iobase); if (rme9652->port) pci_release_regions(rme9652->pci); diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index 7f6a0a0..5e9437b 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c @@ -1064,12 +1064,9 @@ static int sis_chip_free(struct sis7019 *sis) if (sis->irq >= 0) free_irq(sis->irq, sis); - if (sis->ioaddr) - iounmap(sis->ioaddr); - + iounmap(sis->ioaddr); pci_release_regions(sis->pci); pci_disable_device(sis->pci); - sis_free_suspend(sis); return 0; } diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index f5581a9..de7f06f 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -2246,8 +2246,7 @@ static int snd_ymfpci_free(struct snd_ymfpci *chip) release_and_free_resource(chip->mpu_res); release_and_free_resource(chip->fm_res); snd_ymfpci_free_gameport(chip); - if (chip->reg_area_virt) - iounmap(chip->reg_area_virt); + iounmap(chip->reg_area_virt); if (chip->work_ptr.area) snd_dma_free_pages(&chip->work_ptr); diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index 5a13b22..d399df4 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c @@ -867,16 +867,11 @@ static int snd_pmac_free(struct snd_pmac *chip) snd_pmac_dbdma_free(chip, &chip->capture.cmd); snd_pmac_dbdma_free(chip, &chip->extra_dma); snd_pmac_dbdma_free(chip, &emergency_dbdma); - if (chip->macio_base) - iounmap(chip->macio_base); - if (chip->latch_base) - iounmap(chip->latch_base); - if (chip->awacs) - iounmap(chip->awacs); - if (chip->playback.dma) - iounmap(chip->playback.dma); - if (chip->capture.dma) - iounmap(chip->capture.dma); + iounmap(chip->macio_base); + iounmap(chip->latch_base); + iounmap(chip->awacs); + iounmap(chip->playback.dma); + iounmap(chip->capture.dma); if (chip->node) { int i; -- 2.2.1 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 11/13] ALSA: Deletion of checks before the function call "iounmap" 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 1 sibling, 0 replies; 79+ messages in thread From: Dan Carpenter @ 2015-01-05 13:58 UTC (permalink / raw) To: SF Markus Elfring Cc: alsa-devel, Russell King, linux-parisc, Takashi Iwai, kernel-janitors, Clemens Ladisch, LKML, Julia Lawall, Thibaut Varene, Johannes Berg, linuxppc-dev On Sun, Jan 04, 2015 at 02:36:01PM +0100, SF Markus Elfring wrote: > /* unmap PCI memory space, mapped during device init. */ > - for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) { > - if (pci.ap_mem_base[idx]) > - iounmap(pci.ap_mem_base[idx]); > - } > + for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; ++idx) > + iounmap(pci.ap_mem_base[idx]); > Don't do the gratuitous idx++ to ++idx changes. You do it a couple other places as well. It belongs in a separate patch if you really feel it is worth doing. (It is not a clean up and it is not worth doing). regards, dan carpenter ^ permalink raw reply [flat|nested] 79+ messages in thread
* Re: [PATCH 11/13] ALSA: Deletion of checks before the function call "iounmap" 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 1 sibling, 1 reply; 79+ messages in thread From: Dan Carpenter @ 2016-10-26 12:26 UTC (permalink / raw) To: SF Markus Elfring Cc: alsa-devel, Russell King, linux-parisc, Takashi Iwai, kernel-janitors, Clemens Ladisch, LKML, Jaroslav Kysela, Julia Lawall, Thibaut Varene, Johannes Berg, linuxppc-dev Someone was just mentioning in another thread that removing the check from iounmap() is not portable to other arches and then I remembered that Markus removed a bunch of these. We should consider reverting this, perhaps? regards, dan carpenter On Sun, Jan 04, 2015 at 02:36:01PM +0100, SF Markus Elfring wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sat, 3 Jan 2015 22:55:54 +0100 > > The iounmap() function performs also input parameter validation. > 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/aoa/soundbus/i2sbus/core.c | 13 ++++++------- > sound/arm/aaci.c | 4 ++-- > sound/drivers/ml403-ac97cr.c | 3 +-- > sound/isa/msnd/msnd_pinnacle.c | 3 +-- > sound/parisc/harmony.c | 4 +--- > sound/pci/ad1889.c | 5 +---- > sound/pci/asihpi/hpioctl.c | 6 ++---- > sound/pci/atiixp.c | 3 +-- > sound/pci/atiixp_modem.c | 3 +-- > sound/pci/aw2/aw2-alsa.c | 4 +--- > sound/pci/bt87x.c | 3 +-- > sound/pci/cs4281.c | 6 ++---- > sound/pci/cs46xx/cs46xx_lib.c | 4 ++-- > sound/pci/ctxfi/cthw20k1.c | 5 +---- > sound/pci/ctxfi/cthw20k2.c | 5 +---- > sound/pci/echoaudio/echoaudio.c | 6 +----- > sound/pci/hda/hda_intel.c | 3 +-- > sound/pci/lola/lola.c | 6 ++---- > sound/pci/mixart/mixart.c | 7 +++---- > sound/pci/nm256/nm256.c | 6 ++---- > sound/pci/rme9652/hdsp.c | 4 +--- > sound/pci/rme9652/hdspm.c | 4 +--- > sound/pci/rme9652/rme9652.c | 3 +-- > sound/pci/sis7019.c | 5 +---- > sound/pci/ymfpci/ymfpci_main.c | 3 +-- > sound/ppc/pmac.c | 15 +++++---------- > 26 files changed, 43 insertions(+), 90 deletions(-) > > diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c > index 4e2b4fb..7835045 100644 > --- a/sound/aoa/soundbus/i2sbus/core.c > +++ b/sound/aoa/soundbus/i2sbus/core.c > @@ -74,10 +74,9 @@ static void i2sbus_release_dev(struct device *dev) > int i; > > i2sdev = container_of(dev, struct i2sbus_dev, sound.ofdev.dev); > - > - if (i2sdev->intfregs) iounmap(i2sdev->intfregs); > - if (i2sdev->out.dbdma) iounmap(i2sdev->out.dbdma); > - if (i2sdev->in.dbdma) iounmap(i2sdev->in.dbdma); > + iounmap(i2sdev->intfregs); > + iounmap(i2sdev->out.dbdma); > + iounmap(i2sdev->in.dbdma); > for (i = aoa_resource_i2smmio; i <= aoa_resource_rxdbdma; i++) > release_and_free_resource(i2sdev->allocated_resource[i]); > free_dbdma_descriptor_ring(i2sdev, &i2sdev->out.dbdma_ring); > @@ -318,9 +317,9 @@ static int i2sbus_add_dev(struct macio_dev *macio, > free_irq(dev->interrupts[i], dev); > free_dbdma_descriptor_ring(dev, &dev->out.dbdma_ring); > free_dbdma_descriptor_ring(dev, &dev->in.dbdma_ring); > - if (dev->intfregs) iounmap(dev->intfregs); > - if (dev->out.dbdma) iounmap(dev->out.dbdma); > - if (dev->in.dbdma) iounmap(dev->in.dbdma); > + iounmap(dev->intfregs); > + iounmap(dev->out.dbdma); > + iounmap(dev->in.dbdma); > for (i=0;i<3;i++) > release_and_free_resource(dev->allocated_resource[i]); > mutex_destroy(&dev->lock); > diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c > index 0e83a73..4140b1b 100644 > --- a/sound/arm/aaci.c > +++ b/sound/arm/aaci.c > @@ -889,8 +889,8 @@ static int aaci_probe_ac97(struct aaci *aaci) > static void aaci_free_card(struct snd_card *card) > { > struct aaci *aaci = card->private_data; > - if (aaci->base) > - iounmap(aaci->base); > + > + iounmap(aaci->base); > } > > static struct aaci *aaci_init_card(struct amba_device *dev) > diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c > index ec01de1..bdcb572 100644 > --- a/sound/drivers/ml403-ac97cr.c > +++ b/sound/drivers/ml403-ac97cr.c > @@ -1094,8 +1094,7 @@ static int snd_ml403_ac97cr_free(struct snd_ml403_ac97cr *ml403_ac97cr) > if (ml403_ac97cr->capture_irq >= 0) > free_irq(ml403_ac97cr->capture_irq, ml403_ac97cr); > /* give back "port" */ > - if (ml403_ac97cr->port != NULL) > - iounmap(ml403_ac97cr->port); > + iounmap(ml403_ac97cr->port); > kfree(ml403_ac97cr); > PDEBUG(INIT_INFO, "free(): (done)\n"); > return 0; > diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c > index 65b3682..4c07266 100644 > --- a/sound/isa/msnd/msnd_pinnacle.c > +++ b/sound/isa/msnd/msnd_pinnacle.c > @@ -627,8 +627,7 @@ static int snd_msnd_attach(struct snd_card *card) > return 0; > > err_release_region: > - if (chip->mappedbase) > - iounmap(chip->mappedbase); > + iounmap(chip->mappedbase); > release_mem_region(chip->base, BUFFSIZE); > release_region(chip->io, DSP_NUMIO); > free_irq(chip->irq, chip); > diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c > index 29604a2..f2350c1 100644 > --- a/sound/parisc/harmony.c > +++ b/sound/parisc/harmony.c > @@ -893,9 +893,7 @@ snd_harmony_free(struct snd_harmony *h) > if (h->irq >= 0) > free_irq(h->irq, h); > > - if (h->iobase) > - iounmap(h->iobase); > - > + iounmap(h->iobase); > kfree(h); > return 0; > } > diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c > index 547ee30..0de3129 100644 > --- a/sound/pci/ad1889.c > +++ b/sound/pci/ad1889.c > @@ -853,12 +853,9 @@ snd_ad1889_free(struct snd_ad1889 *chip) > free_irq(chip->irq, chip); > > skip_hw: > - if (chip->iobase) > - iounmap(chip->iobase); > - > + iounmap(chip->iobase); > pci_release_regions(chip->pci); > pci_disable_device(chip->pci); > - > kfree(chip); > return 0; > } > diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c > index 72af66b..67d1133 100644 > --- a/sound/pci/asihpi/hpioctl.c > +++ b/sound/pci/asihpi/hpioctl.c > @@ -541,10 +541,8 @@ void asihpi_adapter_remove(struct pci_dev *pci_dev) > hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL); > > /* unmap PCI memory space, mapped during device init. */ > - for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) { > - if (pci.ap_mem_base[idx]) > - iounmap(pci.ap_mem_base[idx]); > - } > + for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; ++idx) > + iounmap(pci.ap_mem_base[idx]); > > if (pa->irq) > free_irq(pa->irq, pa); > diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c > index 9c1c445..d24188f 100644 > --- a/sound/pci/atiixp.c > +++ b/sound/pci/atiixp.c > @@ -1585,8 +1585,7 @@ static int snd_atiixp_free(struct atiixp *chip) > __hw_end: > if (chip->irq >= 0) > free_irq(chip->irq, chip); > - if (chip->remap_addr) > - iounmap(chip->remap_addr); > + iounmap(chip->remap_addr); > pci_release_regions(chip->pci); > pci_disable_device(chip->pci); > kfree(chip); > diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c > index b2f63e0..c321a97 100644 > --- a/sound/pci/atiixp_modem.c > +++ b/sound/pci/atiixp_modem.c > @@ -1211,8 +1211,7 @@ static int snd_atiixp_free(struct atiixp_modem *chip) > __hw_end: > if (chip->irq >= 0) > free_irq(chip->irq, chip); > - if (chip->remap_addr) > - iounmap(chip->remap_addr); > + iounmap(chip->remap_addr); > pci_release_regions(chip->pci); > pci_disable_device(chip->pci); > kfree(chip); > diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c > index e1cf019..8d2fee7 100644 > --- a/sound/pci/aw2/aw2-alsa.c > +++ b/sound/pci/aw2/aw2-alsa.c > @@ -229,9 +229,7 @@ static int snd_aw2_dev_free(struct snd_device *device) > if (chip->irq >= 0) > free_irq(chip->irq, (void *)chip); > /* release the i/o ports & memory */ > - if (chip->iobase_virt) > - iounmap(chip->iobase_virt); > - > + iounmap(chip->iobase_virt); > pci_release_regions(chip->pci); > /* disable the PCI entry */ > pci_disable_device(chip->pci); > diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c > index 058b997..e82ceac 100644 > --- a/sound/pci/bt87x.c > +++ b/sound/pci/bt87x.c > @@ -690,8 +690,7 @@ static int snd_bt87x_free(struct snd_bt87x *chip) > snd_bt87x_stop(chip); > if (chip->irq >= 0) > free_irq(chip->irq, chip); > - if (chip->mmio) > - iounmap(chip->mmio); > + iounmap(chip->mmio); > pci_release_regions(chip->pci); > pci_disable_device(chip->pci); > kfree(chip); > diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c > index 05a4337..ea33911 100644 > --- a/sound/pci/cs4281.c > +++ b/sound/pci/cs4281.c > @@ -1316,10 +1316,8 @@ static int snd_cs4281_free(struct cs4281 *chip) > > if (chip->irq >= 0) > free_irq(chip->irq, chip); > - if (chip->ba0) > - iounmap(chip->ba0); > - if (chip->ba1) > - iounmap(chip->ba1); > + iounmap(chip->ba0); > + iounmap(chip->ba1); > pci_release_regions(chip->pci); > pci_disable_device(chip->pci); > > diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c > index dfec84e..128bbfe 100644 > --- a/sound/pci/cs46xx/cs46xx_lib.c > +++ b/sound/pci/cs46xx/cs46xx_lib.c > @@ -2949,8 +2949,8 @@ static int snd_cs46xx_free(struct snd_cs46xx *chip) > > for (idx = 0; idx < 5; idx++) { > struct snd_cs46xx_region *region = &chip->region.idx[idx]; > - if (region->remap_addr) > - iounmap(region->remap_addr); > + > + iounmap(region->remap_addr); > release_and_free_resource(region->resource); > } > > diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c > index b425aa8..b8b0d8e 100644 > --- a/sound/pci/ctxfi/cthw20k1.c > +++ b/sound/pci/ctxfi/cthw20k1.c > @@ -1985,10 +1985,7 @@ static int hw_card_shutdown(struct hw *hw) > free_irq(hw->irq, hw); > > hw->irq = -1; > - > - if (hw->mem_base) > - iounmap(hw->mem_base); > - > + iounmap(hw->mem_base); > hw->mem_base = NULL; > > if (hw->io_base) > diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c > index 253899d..4e16b4d 100644 > --- a/sound/pci/ctxfi/cthw20k2.c > +++ b/sound/pci/ctxfi/cthw20k2.c > @@ -2110,10 +2110,7 @@ static int hw_card_shutdown(struct hw *hw) > free_irq(hw->irq, hw); > > hw->irq = -1; > - > - if (hw->mem_base) > - iounmap(hw->mem_base); > - > + iounmap(hw->mem_base); > hw->mem_base = NULL; > > if (hw->io_base) > diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c > index 21228ad..98d4f35 100644 > --- a/sound/pci/echoaudio/echoaudio.c > +++ b/sound/pci/echoaudio/echoaudio.c > @@ -1872,12 +1872,8 @@ static int snd_echo_free(struct echoaudio *chip) > if (chip->comm_page) > snd_dma_free_pages(&chip->commpage_dma_buf); > > - if (chip->dsp_registers) > - iounmap(chip->dsp_registers); > - > + iounmap(chip->dsp_registers); > release_and_free_resource(chip->iores); > - > - > pci_disable_device(chip->pci); > > /* release chip data */ > diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c > index d426a0b..a971425 100644 > --- a/sound/pci/hda/hda_intel.c > +++ b/sound/pci/hda/hda_intel.c > @@ -1138,8 +1138,7 @@ static int azx_free(struct azx *chip) > free_irq(chip->irq, (void*)chip); > if (chip->msi) > pci_disable_msi(chip->pci); > - if (chip->remap_addr) > - iounmap(chip->remap_addr); > + iounmap(chip->remap_addr); > > azx_free_stream_pages(chip); > if (chip->region_requested) > diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c > index 4cf4be5..9ff60008 100644 > --- a/sound/pci/lola/lola.c > +++ b/sound/pci/lola/lola.c > @@ -551,10 +551,8 @@ static void lola_free(struct lola *chip) > lola_free_mixer(chip); > if (chip->irq >= 0) > free_irq(chip->irq, (void *)chip); > - if (chip->bar[0].remap_addr) > - iounmap(chip->bar[0].remap_addr); > - if (chip->bar[1].remap_addr) > - iounmap(chip->bar[1].remap_addr); > + iounmap(chip->bar[0].remap_addr); > + iounmap(chip->bar[1].remap_addr); > if (chip->rb.area) > snd_dma_free_pages(&chip->rb); > pci_release_regions(chip->pci); > diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c > index 1faf47e..c3a9f39 100644 > --- a/sound/pci/mixart/mixart.c > +++ b/sound/pci/mixart/mixart.c > @@ -1114,10 +1114,9 @@ static int snd_mixart_free(struct mixart_mgr *mgr) > } > > /* release the i/o ports */ > - for (i = 0; i < 2; i++) { > - if (mgr->mem[i].virt) > - iounmap(mgr->mem[i].virt); > - } > + for (i = 0; i < 2; ++i) > + iounmap(mgr->mem[i].virt); > + > pci_release_regions(mgr->pci); > > /* free flowarray */ > diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c > index 4e41a4e..3f52a44 100644 > --- a/sound/pci/nm256/nm256.c > +++ b/sound/pci/nm256/nm256.c > @@ -1460,10 +1460,8 @@ static int snd_nm256_free(struct nm256 *chip) > if (chip->irq >= 0) > free_irq(chip->irq, chip); > > - if (chip->cport) > - iounmap(chip->cport); > - if (chip->buffer) > - iounmap(chip->buffer); > + iounmap(chip->cport); > + iounmap(chip->buffer); > release_and_free_resource(chip->res_cport); > release_and_free_resource(chip->res_buffer); > > diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c > index cf5a6c8..fe66bcb 100644 > --- a/sound/pci/rme9652/hdsp.c > +++ b/sound/pci/rme9652/hdsp.c > @@ -5309,9 +5309,7 @@ static int snd_hdsp_free(struct hdsp *hdsp) > > release_firmware(hdsp->firmware); > vfree(hdsp->fw_uploaded); > - > - if (hdsp->iobase) > - iounmap(hdsp->iobase); > + iounmap(hdsp->iobase); > > if (hdsp->port) > pci_release_regions(hdsp->pci); > diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c > index 3342705..8109b8e 100644 > --- a/sound/pci/rme9652/hdspm.c > +++ b/sound/pci/rme9652/hdspm.c > @@ -6965,9 +6965,7 @@ static int snd_hdspm_free(struct hdspm * hdspm) > free_irq(hdspm->irq, (void *) hdspm); > > kfree(hdspm->mixer); > - > - if (hdspm->iobase) > - iounmap(hdspm->iobase); > + iounmap(hdspm->iobase); > > if (hdspm->port) > pci_release_regions(hdspm->pci); > diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c > index 6521521..648911c 100644 > --- a/sound/pci/rme9652/rme9652.c > +++ b/sound/pci/rme9652/rme9652.c > @@ -1756,8 +1756,7 @@ static int snd_rme9652_free(struct snd_rme9652 *rme9652) > > if (rme9652->irq >= 0) > free_irq(rme9652->irq, (void *)rme9652); > - if (rme9652->iobase) > - iounmap(rme9652->iobase); > + iounmap(rme9652->iobase); > if (rme9652->port) > pci_release_regions(rme9652->pci); > > diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c > index 7f6a0a0..5e9437b 100644 > --- a/sound/pci/sis7019.c > +++ b/sound/pci/sis7019.c > @@ -1064,12 +1064,9 @@ static int sis_chip_free(struct sis7019 *sis) > if (sis->irq >= 0) > free_irq(sis->irq, sis); > > - if (sis->ioaddr) > - iounmap(sis->ioaddr); > - > + iounmap(sis->ioaddr); > pci_release_regions(sis->pci); > pci_disable_device(sis->pci); > - > sis_free_suspend(sis); > return 0; > } > diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c > index f5581a9..de7f06f 100644 > --- a/sound/pci/ymfpci/ymfpci_main.c > +++ b/sound/pci/ymfpci/ymfpci_main.c > @@ -2246,8 +2246,7 @@ static int snd_ymfpci_free(struct snd_ymfpci *chip) > release_and_free_resource(chip->mpu_res); > release_and_free_resource(chip->fm_res); > snd_ymfpci_free_gameport(chip); > - if (chip->reg_area_virt) > - iounmap(chip->reg_area_virt); > + iounmap(chip->reg_area_virt); > if (chip->work_ptr.area) > snd_dma_free_pages(&chip->work_ptr); > > diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c > index 5a13b22..d399df4 100644 > --- a/sound/ppc/pmac.c > +++ b/sound/ppc/pmac.c > @@ -867,16 +867,11 @@ static int snd_pmac_free(struct snd_pmac *chip) > snd_pmac_dbdma_free(chip, &chip->capture.cmd); > snd_pmac_dbdma_free(chip, &chip->extra_dma); > snd_pmac_dbdma_free(chip, &emergency_dbdma); > - if (chip->macio_base) > - iounmap(chip->macio_base); > - if (chip->latch_base) > - iounmap(chip->latch_base); > - if (chip->awacs) > - iounmap(chip->awacs); > - if (chip->playback.dma) > - iounmap(chip->playback.dma); > - if (chip->capture.dma) > - iounmap(chip->capture.dma); > + iounmap(chip->macio_base); > + iounmap(chip->latch_base); > + iounmap(chip->awacs); > + iounmap(chip->playback.dma); > + iounmap(chip->capture.dma); > > if (chip->node) { > int i; > -- > 2.2.1 > > -- > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 79+ messages in thread
* Re: [PATCH 11/13] ALSA: Deletion of checks before the function call "iounmap" 2016-10-26 12:26 ` Dan Carpenter @ 2016-10-26 12:28 ` Johannes Berg 2016-10-26 12:42 ` Dan Carpenter 0 siblings, 1 reply; 79+ messages in thread From: Johannes Berg @ 2016-10-26 12:28 UTC (permalink / raw) To: Dan Carpenter, SF Markus Elfring Cc: alsa-devel, Russell King, linux-parisc, Takashi Iwai, kernel-janitors, Clemens Ladisch, LKML, Jaroslav Kysela, Julia Lawall, Thibaut Varene, linuxppc-dev On Wed, 2016-10-26 at 15:26 +0300, Dan Carpenter wrote: > Someone was just mentioning in another thread that removing the check > from iounmap() is not portable to other arches and then I remembered > that Markus removed a bunch of these. > > We should consider reverting this, perhaps? Can't we teach all architectures? Not that reverting it would be a problem. johannes ^ permalink raw reply [flat|nested] 79+ messages in thread
* Re: [PATCH 11/13] ALSA: Deletion of checks before the function call "iounmap" 2016-10-26 12:28 ` Johannes Berg @ 2016-10-26 12:42 ` Dan Carpenter 0 siblings, 0 replies; 79+ messages in thread From: Dan Carpenter @ 2016-10-26 12:42 UTC (permalink / raw) To: Johannes Berg Cc: SF Markus Elfring, Jaroslav Kysela, Clemens Ladisch, Russell King, Takashi Iwai, Thibaut Varene, alsa-devel, linuxppc-dev, linux-parisc, LKML, kernel-janitors, Julia Lawall On Wed, Oct 26, 2016 at 02:28:59PM +0200, Johannes Berg wrote: > On Wed, 2016-10-26 at 15:26 +0300, Dan Carpenter wrote: > > Someone was just mentioning in another thread that removing the check > > from iounmap() is not portable to other arches and then I remembered > > that Markus removed a bunch of these. > > > > We should consider reverting this, perhaps? > > Can't we teach all architectures? Not that reverting it would be a > problem. We probably should. I just didn't want to suggest it, in case it sounds like volunteering... I'm not going to be able to do it because I'm on the road for a bit. regards, dan carpenter ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 12/13] ALSA: msnd: One function call less in snd_msnd_attach() after error detection 2015-01-04 12:43 ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks SF Markus Elfring ` (10 preceding siblings ...) 2015-01-04 13:36 ` [PATCH 11/13] ALSA: Deletion of checks before the function call "iounmap" SF Markus Elfring @ 2015-01-04 13:38 ` 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 13 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2015-01-04 13:38 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: Julia Lawall, kernel-janitors, LKML From: Markus Elfring <elfring@users.sourceforge.net> Date: Sun, 4 Jan 2015 11:00:11 +0100 The iounmap() function was called in one case by the snd_msnd_attach() function even if a previous call of the ioremap_nocache() function failed. This implementation detail could be improved by the introduction of another jump label. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- sound/isa/msnd/msnd_pinnacle.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c index 4c07266..e2e940d 100644 --- a/sound/isa/msnd/msnd_pinnacle.c +++ b/sound/isa/msnd/msnd_pinnacle.c @@ -575,23 +575,23 @@ static int snd_msnd_attach(struct snd_card *card) err = snd_msnd_dsp_full_reset(card); if (err < 0) - goto err_release_region; + goto io_unmap; /* Register device */ err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); if (err < 0) - goto err_release_region; + goto io_unmap; err = snd_msnd_pcm(card, 0); if (err < 0) { printk(KERN_ERR LOGNAME ": error creating new PCM device\n"); - goto err_release_region; + goto io_unmap; } err = snd_msndmix_new(card); if (err < 0) { printk(KERN_ERR LOGNAME ": error creating new Mixer device\n"); - goto err_release_region; + goto io_unmap; } @@ -607,7 +607,7 @@ static int snd_msnd_attach(struct snd_card *card) if (err < 0) { printk(KERN_ERR LOGNAME ": error creating new Midi device\n"); - goto err_release_region; + goto io_unmap; } mpu = chip->rmidi->private_data; @@ -622,12 +622,13 @@ static int snd_msnd_attach(struct snd_card *card) err = snd_card_register(card); if (err < 0) - goto err_release_region; + goto io_unmap; return 0; -err_release_region: +io_unmap: iounmap(chip->mappedbase); +err_release_region: release_mem_region(chip->base, BUFFSIZE); release_region(chip->io, DSP_NUMIO); free_irq(chip->irq, chip); -- 2.2.1 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 12/13] ALSA: msnd: One function call less in snd_msnd_attach() after error detection 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2015-01-04 14:18 UTC (permalink / raw) To: SF Markus Elfring; +Cc: Julia Lawall, alsa-devel, kernel-janitors, LKML At Sun, 04 Jan 2015 14:38:38 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sun, 4 Jan 2015 11:00:11 +0100 > > The iounmap() function was called in one case by the snd_msnd_attach() function > even if a previous call of the ioremap_nocache() function failed. > > This implementation detail could be improved by the introduction of another > jump label. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> I didn't apply this and the next one. Using goto label isn't bad for the error paths in general, but using too much nested labels worsens the readability significantly. (Though, it's almost a matter of taste, so I don't want to spend my time for discussing this.) thanks, Takashi > --- > sound/isa/msnd/msnd_pinnacle.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c > index 4c07266..e2e940d 100644 > --- a/sound/isa/msnd/msnd_pinnacle.c > +++ b/sound/isa/msnd/msnd_pinnacle.c > @@ -575,23 +575,23 @@ static int snd_msnd_attach(struct snd_card *card) > > err = snd_msnd_dsp_full_reset(card); > if (err < 0) > - goto err_release_region; > + goto io_unmap; > > /* Register device */ > err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); > if (err < 0) > - goto err_release_region; > + goto io_unmap; > > err = snd_msnd_pcm(card, 0); > if (err < 0) { > printk(KERN_ERR LOGNAME ": error creating new PCM device\n"); > - goto err_release_region; > + goto io_unmap; > } > > err = snd_msndmix_new(card); > if (err < 0) { > printk(KERN_ERR LOGNAME ": error creating new Mixer device\n"); > - goto err_release_region; > + goto io_unmap; > } > > > @@ -607,7 +607,7 @@ static int snd_msnd_attach(struct snd_card *card) > if (err < 0) { > printk(KERN_ERR LOGNAME > ": error creating new Midi device\n"); > - goto err_release_region; > + goto io_unmap; > } > mpu = chip->rmidi->private_data; > > @@ -622,12 +622,13 @@ static int snd_msnd_attach(struct snd_card *card) > > err = snd_card_register(card); > if (err < 0) > - goto err_release_region; > + goto io_unmap; > > return 0; > > -err_release_region: > +io_unmap: > iounmap(chip->mappedbase); > +err_release_region: > release_mem_region(chip->base, BUFFSIZE); > release_region(chip->io, DSP_NUMIO); > free_irq(chip->irq, chip); > -- > 2.2.1 > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH 13/13] ALSA: msnd: Fix centralized exiting from snd_msnd_attach() 2015-01-04 12:43 ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks SF Markus Elfring ` (11 preceding siblings ...) 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 13:41 ` SF Markus Elfring 2015-01-04 14:22 ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks Takashi Iwai 13 siblings, 0 replies; 79+ messages in thread From: SF Markus Elfring @ 2015-01-04 13:41 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: Julia Lawall, kernel-janitors, LKML From: Markus Elfring <elfring@users.sourceforge.net> Date: Sun, 4 Jan 2015 11:47:17 +0100 Two return statements were used by the snd_msnd_attach() function at source code places where the Linux coding style recommends an alternative approach. Let us improve the affected implementation details with adjustments for corresponding jump targets. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- sound/isa/msnd/msnd_pinnacle.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c index e2e940d..0e66e5e 100644 --- a/sound/isa/msnd/msnd_pinnacle.c +++ b/sound/isa/msnd/msnd_pinnacle.c @@ -552,17 +552,16 @@ static int snd_msnd_attach(struct snd_card *card) return err; } if (request_region(chip->io, DSP_NUMIO, card->shortname) == NULL) { - free_irq(chip->irq, chip); - return -EBUSY; + err = -EBUSY; + goto free_an_irq; } if (!request_mem_region(chip->base, BUFFSIZE, card->shortname)) { printk(KERN_ERR LOGNAME ": unable to grab memory region 0x%lx-0x%lx\n", chip->base, chip->base + BUFFSIZE - 1); - release_region(chip->io, DSP_NUMIO); - free_irq(chip->irq, chip); - return -EBUSY; + err = -EBUSY; + goto release_resource_region; } chip->mappedbase = ioremap_nocache(chip->base, 0x8000); if (!chip->mappedbase) { @@ -570,7 +569,7 @@ static int snd_msnd_attach(struct snd_card *card) ": unable to map memory region 0x%lx-0x%lx\n", chip->base, chip->base + BUFFSIZE - 1); err = -EIO; - goto err_release_region; + goto release_memory_region; } err = snd_msnd_dsp_full_reset(card); @@ -628,9 +627,11 @@ static int snd_msnd_attach(struct snd_card *card) io_unmap: iounmap(chip->mappedbase); -err_release_region: +release_memory_region: release_mem_region(chip->base, BUFFSIZE); +release_resource_region: release_region(chip->io, DSP_NUMIO); +free_an_irq: free_irq(chip->irq, chip); return err; } -- 2.2.1 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH 0/13] ALSA: Deletion of some unnecessary checks 2015-01-04 12:43 ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks SF Markus Elfring ` (12 preceding siblings ...) 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 ` Takashi Iwai 13 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2015-01-04 14:22 UTC (permalink / raw) To: SF Markus Elfring Cc: Mark Brown, Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall At Sun, 04 Jan 2015 13:43:11 +0100, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sun, 4 Jan 2015 11:50:12 +0100 > > Further update suggestions were taken into account after several patches > were applied from static source code analysis. > > Markus Elfring (3): > seq: Deletion of unnecessary checks before the function call "snd_midi_event_free" > oss: Deletion of unnecessary checks before the function call "vfree" > emu10k1: Delete an unnecessary check before the function call "kfree" > oxygen: Delete an unnecessary check before the function call "snd_pcm_suspend" > emux: Delete an unnecessary check before the function call "snd_sf_free" > ASoC: Intel: Delete an unnecessary check before the function call "sst_dma_free" > ASoC: fsi: Deletion of unnecessary checks before the function call "clk_enable" > ASoC: Intel: Delete an unnecessary check before the function call "release_firmware" > i2sbus: Delete an unnecessary check before the function call "snd_pcm_suspend_all" > sb: Delete an unnecessary check before the function call "snd_emux_free" > Deletion of checks before the function call "iounmap" > msnd: One function call less in snd_msnd_attach() after error detection > msnd: Fix centralized exiting from snd_msnd_attach() I applied most of them now but leave patches 6-8 left to Mark applying through his tree. As posted in another mail patches 12 and 13 are dropped. BTW, when you sending a new patch series, you should drop the old references tags. thanks, Takashi > > sound/aoa/soundbus/i2sbus/core.c | 13 ++++++------- > sound/arm/aaci.c | 4 ++-- > sound/drivers/ml403-ac97cr.c | 3 +-- > sound/isa/msnd/msnd_pinnacle.c | 31 ++++++++++++++++--------------- > sound/parisc/harmony.c | 4 +--- > sound/pci/ad1889.c | 5 +---- > sound/pci/asihpi/hpioctl.c | 6 ++---- > sound/pci/atiixp.c | 3 +-- > sound/pci/atiixp_modem.c | 3 +-- > sound/pci/aw2/aw2-alsa.c | 4 +--- > sound/pci/bt87x.c | 3 +-- > sound/pci/cs4281.c | 6 ++---- > sound/pci/cs46xx/cs46xx_lib.c | 4 ++-- > sound/pci/ctxfi/cthw20k1.c | 5 +---- > sound/pci/ctxfi/cthw20k2.c | 5 +---- > sound/pci/echoaudio/echoaudio.c | 6 +----- > sound/pci/hda/hda_intel.c | 3 +-- > sound/pci/lola/lola.c | 6 ++---- > sound/pci/mixart/mixart.c | 7 +++---- > sound/pci/nm256/nm256.c | 6 ++---- > sound/pci/rme9652/hdsp.c | 4 +--- > sound/pci/rme9652/hdspm.c | 4 +--- > sound/pci/rme9652/rme9652.c | 3 +-- > sound/pci/sis7019.c | 5 +---- > sound/pci/ymfpci/ymfpci_main.c | 3 +-- > sound/ppc/pmac.c | 15 +++++---------- > 26 files changed, 58 insertions(+), 103 deletions(-) > > -- > 2.2.1 > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH] ALSA: hda: Delete an unnecessary check before the function call "snd_info_free_entry" [not found] ` <5317A59D.4@users.sourceforge.net> ` (17 preceding siblings ...) 2015-01-04 12:43 ` [PATCH 0/13] ALSA: Deletion of some unnecessary checks SF Markus Elfring @ 2015-06-28 9:21 ` 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 2016-07-22 17:07 ` [PATCH] ASoC: Intel: Skylake: Delete an unnecessary check before the function call "release_firmware" SF Markus Elfring 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2015-06-28 9:21 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Sun, 28 Jun 2015 11:15:28 +0200 The snd_info_free_entry() 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> --- sound/pci/hda/patch_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index f852734..2f24338 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -591,7 +591,7 @@ static int eld_proc_new(struct hdmi_spec_per_pin *per_pin, int index) static void eld_proc_free(struct hdmi_spec_per_pin *per_pin) { - if (!per_pin->codec->bus->shutdown && per_pin->proc_entry) { + if (!per_pin->codec->bus->shutdown) { snd_info_free_entry(per_pin->proc_entry); per_pin->proc_entry = NULL; } -- 2.4.4 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH] ALSA: hda: Delete an unnecessary check before the function call "snd_info_free_entry" 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2015-06-29 9:03 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall At Sun, 28 Jun 2015 11:21:36 +0200, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sun, 28 Jun 2015 11:15:28 +0200 > > The snd_info_free_entry() 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> Applied, thanks. Takashi > --- > sound/pci/hda/patch_hdmi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c > index f852734..2f24338 100644 > --- a/sound/pci/hda/patch_hdmi.c > +++ b/sound/pci/hda/patch_hdmi.c > @@ -591,7 +591,7 @@ static int eld_proc_new(struct hdmi_spec_per_pin *per_pin, int index) > > static void eld_proc_free(struct hdmi_spec_per_pin *per_pin) > { > - if (!per_pin->codec->bus->shutdown && per_pin->proc_entry) { > + if (!per_pin->codec->bus->shutdown) { > snd_info_free_entry(per_pin->proc_entry); > per_pin->proc_entry = NULL; > } > -- > 2.4.4 > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH] ALSA: hda: Delete an unnecessary check before the function call "kobject_put" [not found] ` <5317A59D.4@users.sourceforge.net> ` (18 preceding siblings ...) 2015-06-28 9:21 ` [PATCH] ALSA: hda: Delete an unnecessary check before the function call "snd_info_free_entry" SF Markus Elfring @ 2015-07-08 19:31 ` 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 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2015-07-08 19:31 UTC (permalink / raw) To: Jaroslav Kysela, Takashi Iwai, alsa-devel Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Wed, 8 Jul 2015 21:26:02 +0200 The kobject_put() 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> --- sound/hda/hdac_sysfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/hda/hdac_sysfs.c b/sound/hda/hdac_sysfs.c index 0a6ce3b..089b35f 100644 --- a/sound/hda/hdac_sysfs.c +++ b/sound/hda/hdac_sysfs.c @@ -321,8 +321,7 @@ static void widget_tree_free(struct hdac_device *codec) free_widget_node(*p, &widget_node_group); kfree(tree->nodes); } - if (tree->root) - kobject_put(tree->root); + kobject_put(tree->root); kfree(tree); codec->widgets = NULL; } -- 2.4.5 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Re: [PATCH] ALSA: hda: Delete an unnecessary check before the function call "kobject_put" 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 0 siblings, 0 replies; 79+ messages in thread From: Takashi Iwai @ 2015-07-09 12:21 UTC (permalink / raw) To: SF Markus Elfring Cc: Jaroslav Kysela, alsa-devel, LKML, kernel-janitors, Julia Lawall On Wed, 08 Jul 2015 21:31:57 +0200, SF Markus Elfring wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Wed, 8 Jul 2015 21:26:02 +0200 > > The kobject_put() 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> Applied, thanks. Takashi > --- > sound/hda/hdac_sysfs.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/sound/hda/hdac_sysfs.c b/sound/hda/hdac_sysfs.c > index 0a6ce3b..089b35f 100644 > --- a/sound/hda/hdac_sysfs.c > +++ b/sound/hda/hdac_sysfs.c > @@ -321,8 +321,7 @@ static void widget_tree_free(struct hdac_device *codec) > free_widget_node(*p, &widget_node_group); > kfree(tree->nodes); > } > - if (tree->root) > - kobject_put(tree->root); > + kobject_put(tree->root); > kfree(tree); > codec->widgets = NULL; > } > -- > 2.4.5 > ^ permalink raw reply [flat|nested] 79+ messages in thread
* [PATCH] ASoC: Intel: Skylake: Delete an unnecessary check before the function call "release_firmware" [not found] ` <5317A59D.4@users.sourceforge.net> ` (19 preceding siblings ...) 2015-07-08 19:31 ` [PATCH] ALSA: hda: Delete an unnecessary check before the function call "kobject_put" SF Markus Elfring @ 2016-07-22 17:07 ` 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 20 siblings, 1 reply; 79+ messages in thread From: SF Markus Elfring @ 2016-07-22 17:07 UTC (permalink / raw) To: alsa-devel, Jaroslav Kysela, Liam Girdwood, Mark Brown, Takashi Iwai Cc: LKML, kernel-janitors, Julia Lawall From: Markus Elfring <elfring@users.sourceforge.net> Date: Fri, 22 Jul 2016 18:58:14 +0200 The release_firmware() 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> --- sound/soc/intel/skylake/skl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index 2337748..cd59536 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -781,8 +781,7 @@ static void skl_remove(struct pci_dev *pci) struct hdac_ext_bus *ebus = pci_get_drvdata(pci); struct skl *skl = ebus_to_skl(ebus); - if (skl->tplg) - release_firmware(skl->tplg); + release_firmware(skl->tplg); if (pci_dev_run_wake(pci)) pm_runtime_get_noresume(&pci->dev); -- 2.9.2 ^ permalink raw reply related [flat|nested] 79+ messages in thread
* Applied "ASoC: Intel: Skylake: Delete an unnecessary check before the function call "release_firmware"" to the asoc tree 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 ` Mark Brown 0 siblings, 0 replies; 79+ messages in thread From: Mark Brown @ 2016-07-24 21:06 UTC (permalink / raw) To: Markus Elfring; +Cc: Mark Brown, alsa-devel, Jaroslav Kysela, Liam Girdwood The patch ASoC: Intel: Skylake: Delete an unnecessary check before the function call "release_firmware" has been applied to the asoc tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 1b00126cb3de017274e899ac559a744d4e3dbd61 Mon Sep 17 00:00:00 2001 From: Markus Elfring <elfring@users.sourceforge.net> Date: Fri, 22 Jul 2016 18:58:14 +0200 Subject: [PATCH] ASoC: Intel: Skylake: Delete an unnecessary check before the function call "release_firmware" The release_firmware() 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: Mark Brown <broonie@kernel.org> --- sound/soc/intel/skylake/skl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index 2337748ffead..cd59536a761d 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -781,8 +781,7 @@ static void skl_remove(struct pci_dev *pci) struct hdac_ext_bus *ebus = pci_get_drvdata(pci); struct skl *skl = ebus_to_skl(ebus); - if (skl->tplg) - release_firmware(skl->tplg); + release_firmware(skl->tplg); if (pci_dev_run_wake(pci)) pm_runtime_get_noresume(&pci->dev); -- 2.8.1 ^ permalink raw reply related [flat|nested] 79+ messages in thread
end of thread, other threads:[~2016-10-26 12:42 UTC | newest]
Thread overview: 79+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 ` [PATCH resent] ALSA: emu10k1: " SF Markus Elfring
2014-11-03 14:17 ` 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
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).