* [PATCH 0/3] ALSA: ymfpci: Fine-tuning for some function implementations
@ 2017-09-06 19:45 ` SF Markus Elfring
0 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-06 19:45 UTC (permalink / raw)
To: alsa-devel, Bhumika Goyal, David Howells, Ingo Molnar,
Jaroslav Kysela, Takashi Iwai
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 21:37:32 +0200
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Use common error handling code in snd_card_ymfpci_probe()
Use common error handling code in snd_ymfpci_create()
Adjust 17 checks for null pointers
sound/pci/ymfpci/ymfpci.c | 62 ++++++++++++++++++------------------
sound/pci/ymfpci/ymfpci_main.c | 72 ++++++++++++++++++++++--------------------
2 files changed, 67 insertions(+), 67 deletions(-)
--
2.14.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 0/3] ALSA: ymfpci: Fine-tuning for some function implementations
@ 2017-09-06 19:45 ` SF Markus Elfring
0 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-06 19:45 UTC (permalink / raw)
To: alsa-devel, Bhumika Goyal, David Howells, Ingo Molnar,
Jaroslav Kysela, Takashi Iwai
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 21:37:32 +0200
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Use common error handling code in snd_card_ymfpci_probe()
Use common error handling code in snd_ymfpci_create()
Adjust 17 checks for null pointers
sound/pci/ymfpci/ymfpci.c | 62 ++++++++++++++++++------------------
sound/pci/ymfpci/ymfpci_main.c | 72 ++++++++++++++++++++++--------------------
2 files changed, 67 insertions(+), 67 deletions(-)
--
2.14.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 0/3] ALSA: ymfpci: Fine-tuning for some function implementations
@ 2017-09-06 19:45 ` SF Markus Elfring
0 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-06 19:45 UTC (permalink / raw)
To: alsa-devel, Bhumika Goyal, David Howells, Ingo Molnar,
Jaroslav Kysela, Takashi Iwai
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 21:37:32 +0200
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Use common error handling code in snd_card_ymfpci_probe()
Use common error handling code in snd_ymfpci_create()
Adjust 17 checks for null pointers
sound/pci/ymfpci/ymfpci.c | 62 ++++++++++++++++++------------------
sound/pci/ymfpci/ymfpci_main.c | 72 ++++++++++++++++++++++--------------------
2 files changed, 67 insertions(+), 67 deletions(-)
--
2.14.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
2017-09-06 19:45 ` SF Markus Elfring
(?)
@ 2017-09-06 19:46 ` SF Markus Elfring
-1 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-06 19:46 UTC (permalink / raw)
To: alsa-devel, Bhumika Goyal, David Howells, Ingo Molnar,
Jaroslav Kysela, Takashi Iwai
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 20:45:11 +0200
* Add a jump target so that a bit of exception handling can be better
reused at the end of this function.
This issue was detected by using the Coccinelle software.
* The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix a few source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/pci/ymfpci/ymfpci.c | 62 +++++++++++++++++++++++------------------------
1 file changed, 30 insertions(+), 32 deletions(-)
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 4faf3e1ed06a..eafdee384059 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -268,10 +268,9 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
if ((err = snd_ymfpci_create(card, pci,
old_legacy_ctrl,
&chip)) < 0) {
- snd_card_free(card);
release_and_free_resource(mpu_res);
release_and_free_resource(fm_res);
- return err;
+ goto free_card;
}
chip->fm_res = fm_res;
chip->mpu_res = mpu_res;
@@ -283,35 +282,31 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
card->shortname,
chip->reg_area_phys,
chip->irq);
- if ((err = snd_ymfpci_pcm(chip, 0)) < 0) {
- snd_card_free(card);
- return err;
- }
- if ((err = snd_ymfpci_pcm_spdif(chip, 1)) < 0) {
- snd_card_free(card);
- return err;
- }
+ err = snd_ymfpci_pcm(chip, 0);
+ if (err < 0)
+ goto free_card;
+
+ err = snd_ymfpci_pcm_spdif(chip, 1);
+ if (err < 0)
+ goto free_card;
+
err = snd_ymfpci_mixer(chip, rear_switch[dev]);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
+
if (chip->ac97->ext_id & AC97_EI_SDAC) {
err = snd_ymfpci_pcm_4ch(chip, 2);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
+
err = snd_ymfpci_pcm2(chip, 3);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
- }
- if ((err = snd_ymfpci_timer(chip, 0)) < 0) {
- snd_card_free(card);
- return err;
+ if (err < 0)
+ goto free_card;
}
+ err = snd_ymfpci_timer(chip, 0);
+ if (err < 0)
+ goto free_card;
+
if (chip->mpu_res) {
if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI,
mpu_port[dev],
@@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
} else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
- snd_card_free(card);
dev_err(card->dev, "cannot create opl3 hwdep\n");
- return err;
+ goto free_card;
}
}
snd_ymfpci_create_gameport(chip, dev, legacy_ctrl, legacy_ctrl2);
- if ((err = snd_card_register(card)) < 0) {
- snd_card_free(card);
- return err;
- }
+ err = snd_card_register(card);
+ if (err < 0)
+ goto free_card;
+
pci_set_drvdata(pci, card);
dev++;
return 0;
+
+free_card:
+ snd_card_free(card);
+ return err;
}
static void snd_card_ymfpci_remove(struct pci_dev *pci)
--
2.14.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
@ 2017-09-06 19:46 ` SF Markus Elfring
0 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-06 19:46 UTC (permalink / raw)
To: alsa-devel, Bhumika Goyal, David Howells, Ingo Molnar,
Jaroslav Kysela, Takashi Iwai
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 20:45:11 +0200
* Add a jump target so that a bit of exception handling can be better
reused at the end of this function.
This issue was detected by using the Coccinelle software.
* The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix a few source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/pci/ymfpci/ymfpci.c | 62 +++++++++++++++++++++++------------------------
1 file changed, 30 insertions(+), 32 deletions(-)
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 4faf3e1ed06a..eafdee384059 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -268,10 +268,9 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
if ((err = snd_ymfpci_create(card, pci,
old_legacy_ctrl,
&chip)) < 0) {
- snd_card_free(card);
release_and_free_resource(mpu_res);
release_and_free_resource(fm_res);
- return err;
+ goto free_card;
}
chip->fm_res = fm_res;
chip->mpu_res = mpu_res;
@@ -283,35 +282,31 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
card->shortname,
chip->reg_area_phys,
chip->irq);
- if ((err = snd_ymfpci_pcm(chip, 0)) < 0) {
- snd_card_free(card);
- return err;
- }
- if ((err = snd_ymfpci_pcm_spdif(chip, 1)) < 0) {
- snd_card_free(card);
- return err;
- }
+ err = snd_ymfpci_pcm(chip, 0);
+ if (err < 0)
+ goto free_card;
+
+ err = snd_ymfpci_pcm_spdif(chip, 1);
+ if (err < 0)
+ goto free_card;
+
err = snd_ymfpci_mixer(chip, rear_switch[dev]);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
+
if (chip->ac97->ext_id & AC97_EI_SDAC) {
err = snd_ymfpci_pcm_4ch(chip, 2);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
+
err = snd_ymfpci_pcm2(chip, 3);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
- }
- if ((err = snd_ymfpci_timer(chip, 0)) < 0) {
- snd_card_free(card);
- return err;
+ if (err < 0)
+ goto free_card;
}
+ err = snd_ymfpci_timer(chip, 0);
+ if (err < 0)
+ goto free_card;
+
if (chip->mpu_res) {
if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI,
mpu_port[dev],
@@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
} else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
- snd_card_free(card);
dev_err(card->dev, "cannot create opl3 hwdep\n");
- return err;
+ goto free_card;
}
}
snd_ymfpci_create_gameport(chip, dev, legacy_ctrl, legacy_ctrl2);
- if ((err = snd_card_register(card)) < 0) {
- snd_card_free(card);
- return err;
- }
+ err = snd_card_register(card);
+ if (err < 0)
+ goto free_card;
+
pci_set_drvdata(pci, card);
dev++;
return 0;
+
+free_card:
+ snd_card_free(card);
+ return err;
}
static void snd_card_ymfpci_remove(struct pci_dev *pci)
--
2.14.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
@ 2017-09-06 19:46 ` SF Markus Elfring
0 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-06 19:46 UTC (permalink / raw)
To: alsa-devel, Bhumika Goyal, David Howells, Ingo Molnar,
Jaroslav Kysela, Takashi Iwai
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 20:45:11 +0200
* Add a jump target so that a bit of exception handling can be better
reused at the end of this function.
This issue was detected by using the Coccinelle software.
* The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix a few source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/pci/ymfpci/ymfpci.c | 62 +++++++++++++++++++++++------------------------
1 file changed, 30 insertions(+), 32 deletions(-)
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 4faf3e1ed06a..eafdee384059 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -268,10 +268,9 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
if ((err = snd_ymfpci_create(card, pci,
old_legacy_ctrl,
&chip)) < 0) {
- snd_card_free(card);
release_and_free_resource(mpu_res);
release_and_free_resource(fm_res);
- return err;
+ goto free_card;
}
chip->fm_res = fm_res;
chip->mpu_res = mpu_res;
@@ -283,35 +282,31 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
card->shortname,
chip->reg_area_phys,
chip->irq);
- if ((err = snd_ymfpci_pcm(chip, 0)) < 0) {
- snd_card_free(card);
- return err;
- }
- if ((err = snd_ymfpci_pcm_spdif(chip, 1)) < 0) {
- snd_card_free(card);
- return err;
- }
+ err = snd_ymfpci_pcm(chip, 0);
+ if (err < 0)
+ goto free_card;
+
+ err = snd_ymfpci_pcm_spdif(chip, 1);
+ if (err < 0)
+ goto free_card;
+
err = snd_ymfpci_mixer(chip, rear_switch[dev]);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
+
if (chip->ac97->ext_id & AC97_EI_SDAC) {
err = snd_ymfpci_pcm_4ch(chip, 2);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
+
err = snd_ymfpci_pcm2(chip, 3);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
- }
- if ((err = snd_ymfpci_timer(chip, 0)) < 0) {
- snd_card_free(card);
- return err;
+ if (err < 0)
+ goto free_card;
}
+ err = snd_ymfpci_timer(chip, 0);
+ if (err < 0)
+ goto free_card;
+
if (chip->mpu_res) {
if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI,
mpu_port[dev],
@@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
} else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
- snd_card_free(card);
dev_err(card->dev, "cannot create opl3 hwdep\n");
- return err;
+ goto free_card;
}
}
snd_ymfpci_create_gameport(chip, dev, legacy_ctrl, legacy_ctrl2);
- if ((err = snd_card_register(card)) < 0) {
- snd_card_free(card);
- return err;
- }
+ err = snd_card_register(card);
+ if (err < 0)
+ goto free_card;
+
pci_set_drvdata(pci, card);
dev++;
return 0;
+
+free_card:
+ snd_card_free(card);
+ return err;
}
static void snd_card_ymfpci_remove(struct pci_dev *pci)
--
2.14.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 2/3] ALSA: ymfpci: Use common error handling code in snd_ymfpci_create()
2017-09-06 19:45 ` SF Markus Elfring
(?)
@ 2017-09-06 19:48 ` SF Markus Elfring
-1 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-06 19:48 UTC (permalink / raw)
To: alsa-devel, Bhumika Goyal, David Howells, Ingo Molnar,
Jaroslav Kysela, Takashi Iwai
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 21:12:51 +0200
* Add a jump target so that a bit of exception handling can be better
reused at the end of this function.
This issue was detected by using the Coccinelle software.
* The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix a few source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/pci/ymfpci/ymfpci_main.c | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index edfd58248082..8ca2e41e5827 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -2399,59 +2399,60 @@ int snd_ymfpci_create(struct snd_card *card,
dev_err(chip->card->dev,
"unable to grab memory region 0x%lx-0x%lx\n",
chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1);
- snd_ymfpci_free(chip);
- return -EBUSY;
+ err = -EBUSY;
+ goto free_chip;
}
if (request_irq(pci->irq, snd_ymfpci_interrupt, IRQF_SHARED,
KBUILD_MODNAME, chip)) {
dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq);
- snd_ymfpci_free(chip);
- return -EBUSY;
+ err = -EBUSY;
+ goto free_chip;
}
chip->irq = pci->irq;
snd_ymfpci_aclink_reset(pci);
if (snd_ymfpci_codec_ready(chip, 0) < 0) {
- snd_ymfpci_free(chip);
- return -EIO;
+ err = -EIO;
+ goto free_chip;
}
err = snd_ymfpci_request_firmware(chip);
if (err < 0) {
dev_err(chip->card->dev, "firmware request failed: %d\n", err);
- snd_ymfpci_free(chip);
- return err;
+ goto free_chip;
}
snd_ymfpci_download_image(chip);
udelay(100); /* seems we need a delay after downloading image.. */
if (snd_ymfpci_memalloc(chip) < 0) {
- snd_ymfpci_free(chip);
- return -EIO;
+ err = -EIO;
+ goto free_chip;
}
- if ((err = snd_ymfpci_ac3_init(chip)) < 0) {
- snd_ymfpci_free(chip);
- return err;
- }
+ err = snd_ymfpci_ac3_init(chip);
+ if (err < 0)
+ goto free_chip;
#ifdef CONFIG_PM_SLEEP
chip->saved_regs = kmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32),
GFP_KERNEL);
if (chip->saved_regs == NULL) {
- snd_ymfpci_free(chip);
- return -ENOMEM;
+ err = -ENOMEM;
+ goto free_chip;
}
#endif
- if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
- snd_ymfpci_free(chip);
- return err;
- }
+ err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
+ if (err < 0)
+ goto free_chip;
snd_ymfpci_proc_init(card, chip);
*rchip = chip;
return 0;
+
+free_chip:
+ snd_ymfpci_free(chip);
+ return err;
}
--
2.14.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 2/3] ALSA: ymfpci: Use common error handling code in snd_ymfpci_create()
@ 2017-09-06 19:48 ` SF Markus Elfring
0 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-06 19:48 UTC (permalink / raw)
To: alsa-devel, Bhumika Goyal, David Howells, Ingo Molnar,
Jaroslav Kysela, Takashi Iwai
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 21:12:51 +0200
* Add a jump target so that a bit of exception handling can be better
reused at the end of this function.
This issue was detected by using the Coccinelle software.
* The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix a few source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/pci/ymfpci/ymfpci_main.c | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index edfd58248082..8ca2e41e5827 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -2399,59 +2399,60 @@ int snd_ymfpci_create(struct snd_card *card,
dev_err(chip->card->dev,
"unable to grab memory region 0x%lx-0x%lx\n",
chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1);
- snd_ymfpci_free(chip);
- return -EBUSY;
+ err = -EBUSY;
+ goto free_chip;
}
if (request_irq(pci->irq, snd_ymfpci_interrupt, IRQF_SHARED,
KBUILD_MODNAME, chip)) {
dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq);
- snd_ymfpci_free(chip);
- return -EBUSY;
+ err = -EBUSY;
+ goto free_chip;
}
chip->irq = pci->irq;
snd_ymfpci_aclink_reset(pci);
if (snd_ymfpci_codec_ready(chip, 0) < 0) {
- snd_ymfpci_free(chip);
- return -EIO;
+ err = -EIO;
+ goto free_chip;
}
err = snd_ymfpci_request_firmware(chip);
if (err < 0) {
dev_err(chip->card->dev, "firmware request failed: %d\n", err);
- snd_ymfpci_free(chip);
- return err;
+ goto free_chip;
}
snd_ymfpci_download_image(chip);
udelay(100); /* seems we need a delay after downloading image.. */
if (snd_ymfpci_memalloc(chip) < 0) {
- snd_ymfpci_free(chip);
- return -EIO;
+ err = -EIO;
+ goto free_chip;
}
- if ((err = snd_ymfpci_ac3_init(chip)) < 0) {
- snd_ymfpci_free(chip);
- return err;
- }
+ err = snd_ymfpci_ac3_init(chip);
+ if (err < 0)
+ goto free_chip;
#ifdef CONFIG_PM_SLEEP
chip->saved_regs = kmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32),
GFP_KERNEL);
if (chip->saved_regs = NULL) {
- snd_ymfpci_free(chip);
- return -ENOMEM;
+ err = -ENOMEM;
+ goto free_chip;
}
#endif
- if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
- snd_ymfpci_free(chip);
- return err;
- }
+ err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
+ if (err < 0)
+ goto free_chip;
snd_ymfpci_proc_init(card, chip);
*rchip = chip;
return 0;
+
+free_chip:
+ snd_ymfpci_free(chip);
+ return err;
}
--
2.14.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 2/3] ALSA: ymfpci: Use common error handling code in snd_ymfpci_create()
@ 2017-09-06 19:48 ` SF Markus Elfring
0 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-06 19:48 UTC (permalink / raw)
To: alsa-devel, Bhumika Goyal, David Howells, Ingo Molnar,
Jaroslav Kysela, Takashi Iwai
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 21:12:51 +0200
* Add a jump target so that a bit of exception handling can be better
reused at the end of this function.
This issue was detected by using the Coccinelle software.
* The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix a few source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/pci/ymfpci/ymfpci_main.c | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index edfd58248082..8ca2e41e5827 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -2399,59 +2399,60 @@ int snd_ymfpci_create(struct snd_card *card,
dev_err(chip->card->dev,
"unable to grab memory region 0x%lx-0x%lx\n",
chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1);
- snd_ymfpci_free(chip);
- return -EBUSY;
+ err = -EBUSY;
+ goto free_chip;
}
if (request_irq(pci->irq, snd_ymfpci_interrupt, IRQF_SHARED,
KBUILD_MODNAME, chip)) {
dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq);
- snd_ymfpci_free(chip);
- return -EBUSY;
+ err = -EBUSY;
+ goto free_chip;
}
chip->irq = pci->irq;
snd_ymfpci_aclink_reset(pci);
if (snd_ymfpci_codec_ready(chip, 0) < 0) {
- snd_ymfpci_free(chip);
- return -EIO;
+ err = -EIO;
+ goto free_chip;
}
err = snd_ymfpci_request_firmware(chip);
if (err < 0) {
dev_err(chip->card->dev, "firmware request failed: %d\n", err);
- snd_ymfpci_free(chip);
- return err;
+ goto free_chip;
}
snd_ymfpci_download_image(chip);
udelay(100); /* seems we need a delay after downloading image.. */
if (snd_ymfpci_memalloc(chip) < 0) {
- snd_ymfpci_free(chip);
- return -EIO;
+ err = -EIO;
+ goto free_chip;
}
- if ((err = snd_ymfpci_ac3_init(chip)) < 0) {
- snd_ymfpci_free(chip);
- return err;
- }
+ err = snd_ymfpci_ac3_init(chip);
+ if (err < 0)
+ goto free_chip;
#ifdef CONFIG_PM_SLEEP
chip->saved_regs = kmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32),
GFP_KERNEL);
if (chip->saved_regs == NULL) {
- snd_ymfpci_free(chip);
- return -ENOMEM;
+ err = -ENOMEM;
+ goto free_chip;
}
#endif
- if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
- snd_ymfpci_free(chip);
- return err;
- }
+ err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
+ if (err < 0)
+ goto free_chip;
snd_ymfpci_proc_init(card, chip);
*rchip = chip;
return 0;
+
+free_chip:
+ snd_ymfpci_free(chip);
+ return err;
}
--
2.14.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 3/3] ALSA: ymfpci: Adjust 17 checks for null pointers
2017-09-06 19:45 ` SF Markus Elfring
(?)
@ 2017-09-06 19:50 ` SF Markus Elfring
-1 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-06 19:50 UTC (permalink / raw)
To: alsa-devel, Bhumika Goyal, David Howells, Ingo Molnar,
Jaroslav Kysela, Takashi Iwai
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 21:30:37 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written …
Thus fix affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/pci/ymfpci/ymfpci_main.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 8ca2e41e5827..4da6e43ad007 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -308,7 +308,7 @@ static void snd_ymfpci_pcm_interrupt(struct snd_ymfpci *chip, struct snd_ymfpci_
if ((ypcm = voice->ypcm) == NULL)
return;
- if (ypcm->substream == NULL)
+ if (!ypcm->substream)
return;
spin_lock(&chip->reg_lock);
if (ypcm->running) {
@@ -396,7 +396,7 @@ static int snd_ymfpci_playback_trigger(struct snd_pcm_substream *substream,
int result = 0;
spin_lock(&chip->reg_lock);
- if (ypcm->voices[0] == NULL) {
+ if (!ypcm->voices[0]) {
result = -EINVAL;
goto __unlock;
}
@@ -405,7 +405,7 @@ static int snd_ymfpci_playback_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
chip->ctrl_playback[ypcm->voices[0]->number + 1] = cpu_to_le32(ypcm->voices[0]->bank_addr);
- if (ypcm->voices[1] != NULL && !ypcm->use_441_slot)
+ if (ypcm->voices[1] && !ypcm->use_441_slot)
chip->ctrl_playback[ypcm->voices[1]->number + 1] = cpu_to_le32(ypcm->voices[1]->bank_addr);
ypcm->running = 1;
break;
@@ -418,7 +418,7 @@ static int snd_ymfpci_playback_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND:
chip->ctrl_playback[ypcm->voices[0]->number + 1] = 0;
- if (ypcm->voices[1] != NULL && !ypcm->use_441_slot)
+ if (ypcm->voices[1] && !ypcm->use_441_slot)
chip->ctrl_playback[ypcm->voices[1]->number + 1] = 0;
ypcm->running = 0;
break;
@@ -468,16 +468,16 @@ static int snd_ymfpci_pcm_voice_alloc(struct snd_ymfpci_pcm *ypcm, int voices)
{
int err;
- if (ypcm->voices[1] != NULL && voices < 2) {
+ if (ypcm->voices[1] && voices < 2) {
snd_ymfpci_voice_free(ypcm->chip, ypcm->voices[1]);
ypcm->voices[1] = NULL;
}
- if (voices == 1 && ypcm->voices[0] != NULL)
+ if (voices == 1 && ypcm->voices[0])
return 0; /* already allocated */
- if (voices == 2 && ypcm->voices[0] != NULL && ypcm->voices[1] != NULL)
+ if (voices == 2 && ypcm->voices[0] && ypcm->voices[1])
return 0; /* already allocated */
if (voices > 1) {
- if (ypcm->voices[0] != NULL && ypcm->voices[1] == NULL) {
+ if (ypcm->voices[0] && !ypcm->voices[1]) {
snd_ymfpci_voice_free(ypcm->chip, ypcm->voices[0]);
ypcm->voices[0] = NULL;
}
@@ -655,7 +655,7 @@ static int snd_ymfpci_playback_hw_free(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_ymfpci_pcm *ypcm;
- if (runtime->private_data == NULL)
+ if (!runtime->private_data)
return 0;
ypcm = runtime->private_data;
@@ -913,7 +913,7 @@ static int snd_ymfpci_playback_open_1(struct snd_pcm_substream *substream)
return err;
ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
- if (ypcm == NULL)
+ if (!ypcm)
return -ENOMEM;
ypcm->chip = chip;
ypcm->type = PLAYBACK_VOICE;
@@ -1038,7 +1038,7 @@ static int snd_ymfpci_capture_open(struct snd_pcm_substream *substream,
return err;
ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
- if (ypcm == NULL)
+ if (!ypcm)
return -ENOMEM;
ypcm->chip = chip;
ypcm->type = capture_bank_number + CAPTURE_REC;
@@ -1116,7 +1116,7 @@ static int snd_ymfpci_capture_close(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_ymfpci_pcm *ypcm = runtime->private_data;
- if (ypcm != NULL) {
+ if (ypcm) {
chip->capture_substream[ypcm->capture_bank_number] = NULL;
snd_ymfpci_hw_stop(chip);
}
@@ -1310,7 +1310,8 @@ static int snd_ymfpci_spdif_default_put(struct snd_kcontrol *kcontrol,
spin_lock_irq(&chip->reg_lock);
change = chip->spdif_bits != val;
chip->spdif_bits = val;
- if ((snd_ymfpci_readw(chip, YDSXGR_SPDIFOUTCTRL) & 1) && chip->pcm_spdif == NULL)
+ if ((snd_ymfpci_readw(chip, YDSXGR_SPDIFOUTCTRL) & 1) &&
+ !chip->pcm_spdif)
snd_ymfpci_writew(chip, YDSXGR_SPDIFOUTSTATUS, chip->spdif_bits);
spin_unlock_irq(&chip->reg_lock);
return change;
@@ -2376,7 +2377,7 @@ int snd_ymfpci_create(struct snd_card *card,
return err;
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
- if (chip == NULL) {
+ if (!chip) {
pci_disable_device(pci);
return -ENOMEM;
}
@@ -2437,7 +2438,7 @@ int snd_ymfpci_create(struct snd_card *card,
#ifdef CONFIG_PM_SLEEP
chip->saved_regs = kmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32),
GFP_KERNEL);
- if (chip->saved_regs == NULL) {
+ if (!chip->saved_regs) {
err = -ENOMEM;
goto free_chip;
}
--
2.14.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 3/3] ALSA: ymfpci: Adjust 17 checks for null pointers
@ 2017-09-06 19:50 ` SF Markus Elfring
0 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-06 19:50 UTC (permalink / raw)
To: alsa-devel, Bhumika Goyal, David Howells, Ingo Molnar,
Jaroslav Kysela, Takashi Iwai
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 21:30:37 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written …
Thus fix affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/pci/ymfpci/ymfpci_main.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 8ca2e41e5827..4da6e43ad007 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -308,7 +308,7 @@ static void snd_ymfpci_pcm_interrupt(struct snd_ymfpci *chip, struct snd_ymfpci_
if ((ypcm = voice->ypcm) = NULL)
return;
- if (ypcm->substream = NULL)
+ if (!ypcm->substream)
return;
spin_lock(&chip->reg_lock);
if (ypcm->running) {
@@ -396,7 +396,7 @@ static int snd_ymfpci_playback_trigger(struct snd_pcm_substream *substream,
int result = 0;
spin_lock(&chip->reg_lock);
- if (ypcm->voices[0] = NULL) {
+ if (!ypcm->voices[0]) {
result = -EINVAL;
goto __unlock;
}
@@ -405,7 +405,7 @@ static int snd_ymfpci_playback_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
chip->ctrl_playback[ypcm->voices[0]->number + 1] = cpu_to_le32(ypcm->voices[0]->bank_addr);
- if (ypcm->voices[1] != NULL && !ypcm->use_441_slot)
+ if (ypcm->voices[1] && !ypcm->use_441_slot)
chip->ctrl_playback[ypcm->voices[1]->number + 1] = cpu_to_le32(ypcm->voices[1]->bank_addr);
ypcm->running = 1;
break;
@@ -418,7 +418,7 @@ static int snd_ymfpci_playback_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND:
chip->ctrl_playback[ypcm->voices[0]->number + 1] = 0;
- if (ypcm->voices[1] != NULL && !ypcm->use_441_slot)
+ if (ypcm->voices[1] && !ypcm->use_441_slot)
chip->ctrl_playback[ypcm->voices[1]->number + 1] = 0;
ypcm->running = 0;
break;
@@ -468,16 +468,16 @@ static int snd_ymfpci_pcm_voice_alloc(struct snd_ymfpci_pcm *ypcm, int voices)
{
int err;
- if (ypcm->voices[1] != NULL && voices < 2) {
+ if (ypcm->voices[1] && voices < 2) {
snd_ymfpci_voice_free(ypcm->chip, ypcm->voices[1]);
ypcm->voices[1] = NULL;
}
- if (voices = 1 && ypcm->voices[0] != NULL)
+ if (voices = 1 && ypcm->voices[0])
return 0; /* already allocated */
- if (voices = 2 && ypcm->voices[0] != NULL && ypcm->voices[1] != NULL)
+ if (voices = 2 && ypcm->voices[0] && ypcm->voices[1])
return 0; /* already allocated */
if (voices > 1) {
- if (ypcm->voices[0] != NULL && ypcm->voices[1] = NULL) {
+ if (ypcm->voices[0] && !ypcm->voices[1]) {
snd_ymfpci_voice_free(ypcm->chip, ypcm->voices[0]);
ypcm->voices[0] = NULL;
}
@@ -655,7 +655,7 @@ static int snd_ymfpci_playback_hw_free(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_ymfpci_pcm *ypcm;
- if (runtime->private_data = NULL)
+ if (!runtime->private_data)
return 0;
ypcm = runtime->private_data;
@@ -913,7 +913,7 @@ static int snd_ymfpci_playback_open_1(struct snd_pcm_substream *substream)
return err;
ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
- if (ypcm = NULL)
+ if (!ypcm)
return -ENOMEM;
ypcm->chip = chip;
ypcm->type = PLAYBACK_VOICE;
@@ -1038,7 +1038,7 @@ static int snd_ymfpci_capture_open(struct snd_pcm_substream *substream,
return err;
ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
- if (ypcm = NULL)
+ if (!ypcm)
return -ENOMEM;
ypcm->chip = chip;
ypcm->type = capture_bank_number + CAPTURE_REC;
@@ -1116,7 +1116,7 @@ static int snd_ymfpci_capture_close(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_ymfpci_pcm *ypcm = runtime->private_data;
- if (ypcm != NULL) {
+ if (ypcm) {
chip->capture_substream[ypcm->capture_bank_number] = NULL;
snd_ymfpci_hw_stop(chip);
}
@@ -1310,7 +1310,8 @@ static int snd_ymfpci_spdif_default_put(struct snd_kcontrol *kcontrol,
spin_lock_irq(&chip->reg_lock);
change = chip->spdif_bits != val;
chip->spdif_bits = val;
- if ((snd_ymfpci_readw(chip, YDSXGR_SPDIFOUTCTRL) & 1) && chip->pcm_spdif = NULL)
+ if ((snd_ymfpci_readw(chip, YDSXGR_SPDIFOUTCTRL) & 1) &&
+ !chip->pcm_spdif)
snd_ymfpci_writew(chip, YDSXGR_SPDIFOUTSTATUS, chip->spdif_bits);
spin_unlock_irq(&chip->reg_lock);
return change;
@@ -2376,7 +2377,7 @@ int snd_ymfpci_create(struct snd_card *card,
return err;
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
- if (chip = NULL) {
+ if (!chip) {
pci_disable_device(pci);
return -ENOMEM;
}
@@ -2437,7 +2438,7 @@ int snd_ymfpci_create(struct snd_card *card,
#ifdef CONFIG_PM_SLEEP
chip->saved_regs = kmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32),
GFP_KERNEL);
- if (chip->saved_regs = NULL) {
+ if (!chip->saved_regs) {
err = -ENOMEM;
goto free_chip;
}
--
2.14.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 3/3] ALSA: ymfpci: Adjust 17 checks for null pointers
@ 2017-09-06 19:50 ` SF Markus Elfring
0 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-06 19:50 UTC (permalink / raw)
To: alsa-devel, Bhumika Goyal, David Howells, Ingo Molnar,
Jaroslav Kysela, Takashi Iwai
Cc: kernel-janitors, LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 21:30:37 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written …
Thus fix affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/pci/ymfpci/ymfpci_main.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 8ca2e41e5827..4da6e43ad007 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -308,7 +308,7 @@ static void snd_ymfpci_pcm_interrupt(struct snd_ymfpci *chip, struct snd_ymfpci_
if ((ypcm = voice->ypcm) == NULL)
return;
- if (ypcm->substream == NULL)
+ if (!ypcm->substream)
return;
spin_lock(&chip->reg_lock);
if (ypcm->running) {
@@ -396,7 +396,7 @@ static int snd_ymfpci_playback_trigger(struct snd_pcm_substream *substream,
int result = 0;
spin_lock(&chip->reg_lock);
- if (ypcm->voices[0] == NULL) {
+ if (!ypcm->voices[0]) {
result = -EINVAL;
goto __unlock;
}
@@ -405,7 +405,7 @@ static int snd_ymfpci_playback_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
chip->ctrl_playback[ypcm->voices[0]->number + 1] = cpu_to_le32(ypcm->voices[0]->bank_addr);
- if (ypcm->voices[1] != NULL && !ypcm->use_441_slot)
+ if (ypcm->voices[1] && !ypcm->use_441_slot)
chip->ctrl_playback[ypcm->voices[1]->number + 1] = cpu_to_le32(ypcm->voices[1]->bank_addr);
ypcm->running = 1;
break;
@@ -418,7 +418,7 @@ static int snd_ymfpci_playback_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND:
chip->ctrl_playback[ypcm->voices[0]->number + 1] = 0;
- if (ypcm->voices[1] != NULL && !ypcm->use_441_slot)
+ if (ypcm->voices[1] && !ypcm->use_441_slot)
chip->ctrl_playback[ypcm->voices[1]->number + 1] = 0;
ypcm->running = 0;
break;
@@ -468,16 +468,16 @@ static int snd_ymfpci_pcm_voice_alloc(struct snd_ymfpci_pcm *ypcm, int voices)
{
int err;
- if (ypcm->voices[1] != NULL && voices < 2) {
+ if (ypcm->voices[1] && voices < 2) {
snd_ymfpci_voice_free(ypcm->chip, ypcm->voices[1]);
ypcm->voices[1] = NULL;
}
- if (voices == 1 && ypcm->voices[0] != NULL)
+ if (voices == 1 && ypcm->voices[0])
return 0; /* already allocated */
- if (voices == 2 && ypcm->voices[0] != NULL && ypcm->voices[1] != NULL)
+ if (voices == 2 && ypcm->voices[0] && ypcm->voices[1])
return 0; /* already allocated */
if (voices > 1) {
- if (ypcm->voices[0] != NULL && ypcm->voices[1] == NULL) {
+ if (ypcm->voices[0] && !ypcm->voices[1]) {
snd_ymfpci_voice_free(ypcm->chip, ypcm->voices[0]);
ypcm->voices[0] = NULL;
}
@@ -655,7 +655,7 @@ static int snd_ymfpci_playback_hw_free(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_ymfpci_pcm *ypcm;
- if (runtime->private_data == NULL)
+ if (!runtime->private_data)
return 0;
ypcm = runtime->private_data;
@@ -913,7 +913,7 @@ static int snd_ymfpci_playback_open_1(struct snd_pcm_substream *substream)
return err;
ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
- if (ypcm == NULL)
+ if (!ypcm)
return -ENOMEM;
ypcm->chip = chip;
ypcm->type = PLAYBACK_VOICE;
@@ -1038,7 +1038,7 @@ static int snd_ymfpci_capture_open(struct snd_pcm_substream *substream,
return err;
ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
- if (ypcm == NULL)
+ if (!ypcm)
return -ENOMEM;
ypcm->chip = chip;
ypcm->type = capture_bank_number + CAPTURE_REC;
@@ -1116,7 +1116,7 @@ static int snd_ymfpci_capture_close(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_ymfpci_pcm *ypcm = runtime->private_data;
- if (ypcm != NULL) {
+ if (ypcm) {
chip->capture_substream[ypcm->capture_bank_number] = NULL;
snd_ymfpci_hw_stop(chip);
}
@@ -1310,7 +1310,8 @@ static int snd_ymfpci_spdif_default_put(struct snd_kcontrol *kcontrol,
spin_lock_irq(&chip->reg_lock);
change = chip->spdif_bits != val;
chip->spdif_bits = val;
- if ((snd_ymfpci_readw(chip, YDSXGR_SPDIFOUTCTRL) & 1) && chip->pcm_spdif == NULL)
+ if ((snd_ymfpci_readw(chip, YDSXGR_SPDIFOUTCTRL) & 1) &&
+ !chip->pcm_spdif)
snd_ymfpci_writew(chip, YDSXGR_SPDIFOUTSTATUS, chip->spdif_bits);
spin_unlock_irq(&chip->reg_lock);
return change;
@@ -2376,7 +2377,7 @@ int snd_ymfpci_create(struct snd_card *card,
return err;
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
- if (chip == NULL) {
+ if (!chip) {
pci_disable_device(pci);
return -ENOMEM;
}
@@ -2437,7 +2438,7 @@ int snd_ymfpci_create(struct snd_card *card,
#ifdef CONFIG_PM_SLEEP
chip->saved_regs = kmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32),
GFP_KERNEL);
- if (chip->saved_regs == NULL) {
+ if (!chip->saved_regs) {
err = -ENOMEM;
goto free_chip;
}
--
2.14.1
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
2017-09-06 19:46 ` SF Markus Elfring
(?)
@ 2017-09-06 21:51 ` Dan Carpenter
-1 siblings, 0 replies; 30+ messages in thread
From: Dan Carpenter @ 2017-09-06 21:51 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Bhumika Goyal, David Howells, Ingo Molnar,
Jaroslav Kysela, Takashi Iwai, LKML, kernel-janitors
On Wed, Sep 06, 2017 at 09:46:52PM +0200, SF Markus Elfring wrote:
> @@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
> legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
> pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
> } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
> - snd_card_free(card);
^^^^^^^^^^^^^^^^^^^
> dev_err(card->dev, "cannot create opl3 hwdep\n");
^^^^^^^^^
> - return err;
> + goto free_card;
Heh. I was worried that some of these re-orderings would introduce bugs
but actually this one fixes a use after free.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
@ 2017-09-06 21:51 ` Dan Carpenter
0 siblings, 0 replies; 30+ messages in thread
From: Dan Carpenter @ 2017-09-06 21:51 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, LKML, kernel-janitors, Takashi Iwai, David Howells,
Ingo Molnar, Bhumika Goyal
On Wed, Sep 06, 2017 at 09:46:52PM +0200, SF Markus Elfring wrote:
> @@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
> legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
> pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
> } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
> - snd_card_free(card);
^^^^^^^^^^^^^^^^^^^
> dev_err(card->dev, "cannot create opl3 hwdep\n");
^^^^^^^^^
> - return err;
> + goto free_card;
Heh. I was worried that some of these re-orderings would introduce bugs
but actually this one fixes a use after free.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
@ 2017-09-06 21:51 ` Dan Carpenter
0 siblings, 0 replies; 30+ messages in thread
From: Dan Carpenter @ 2017-09-06 21:51 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, LKML, kernel-janitors, Takashi Iwai, David Howells,
Ingo Molnar, Bhumika Goyal
On Wed, Sep 06, 2017 at 09:46:52PM +0200, SF Markus Elfring wrote:
> @@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
> legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
> pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
> } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
> - snd_card_free(card);
^^^^^^^^^^^^^^^^^^^
> dev_err(card->dev, "cannot create opl3 hwdep\n");
^^^^^^^^^
> - return err;
> + goto free_card;
Heh. I was worried that some of these re-orderings would introduce bugs
but actually this one fixes a use after free.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
2017-09-06 21:51 ` Dan Carpenter
(?)
@ 2017-09-07 7:41 ` SF Markus Elfring
-1 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-07 7:41 UTC (permalink / raw)
To: Dan Carpenter, alsa-devel
Cc: Bhumika Goyal, David Howells, Ingo Molnar, Jaroslav Kysela,
Takashi Iwai, LKML, kernel-janitors
>> @@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
>> legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
>> pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
>> } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
>> - snd_card_free(card);
> ^^^^^^^^^^^^^^^^^^^
>> dev_err(card->dev, "cannot create opl3 hwdep\n");
> ^^^^^^^^^
>> - return err;
>> + goto free_card;
>
> Heh. I was worried that some of these re-orderings would introduce bugs
> but actually this one fixes a use after free.
Thanks for your constructive feedback.
Does it mean that a special tag should be added to a commit message?
Regards,
Markus
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
@ 2017-09-07 7:41 ` SF Markus Elfring
0 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-07 7:41 UTC (permalink / raw)
To: Dan Carpenter, alsa-devel
Cc: kernel-janitors, LKML, Takashi Iwai, David Howells, Ingo Molnar,
Bhumika Goyal
>> @@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
>> legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
>> pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
>> } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
>> - snd_card_free(card);
> ^^^^^^^^^^^^^^^^^^^
>> dev_err(card->dev, "cannot create opl3 hwdep\n");
> ^^^^^^^^^
>> - return err;
>> + goto free_card;
>
> Heh. I was worried that some of these re-orderings would introduce bugs
> but actually this one fixes a use after free.
Thanks for your constructive feedback.
Does it mean that a special tag should be added to a commit message?
Regards,
Markus
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
@ 2017-09-07 7:41 ` SF Markus Elfring
0 siblings, 0 replies; 30+ messages in thread
From: SF Markus Elfring @ 2017-09-07 7:41 UTC (permalink / raw)
To: Dan Carpenter, alsa-devel
Cc: kernel-janitors, LKML, Takashi Iwai, David Howells, Ingo Molnar,
Bhumika Goyal
>> @@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
>> legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
>> pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
>> } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
>> - snd_card_free(card);
> ^^^^^^^^^^^^^^^^^^^
>> dev_err(card->dev, "cannot create opl3 hwdep\n");
> ^^^^^^^^^
>> - return err;
>> + goto free_card;
>
> Heh. I was worried that some of these re-orderings would introduce bugs
> but actually this one fixes a use after free.
Thanks for your constructive feedback.
Does it mean that a special tag should be added to a commit message?
Regards,
Markus
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
2017-09-07 7:41 ` SF Markus Elfring
(?)
@ 2017-09-07 8:09 ` Takashi Iwai
-1 siblings, 0 replies; 30+ messages in thread
From: Takashi Iwai @ 2017-09-07 8:09 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Dan Carpenter, Bhumika Goyal, Ingo Molnar,
Jaroslav Kysela, David Howells, kernel-janitors, LKML
On Thu, 07 Sep 2017 09:41:39 +0200,
SF Markus Elfring wrote:
>
> >> @@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
> >> legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
> >> pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
> >> } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
> >> - snd_card_free(card);
> > ^^^^^^^^^^^^^^^^^^^
> >> dev_err(card->dev, "cannot create opl3 hwdep\n");
> > ^^^^^^^^^
> >> - return err;
> >> + goto free_card;
> >
> > Heh. I was worried that some of these re-orderings would introduce bugs
> > but actually this one fixes a use after free.
>
> Thanks for your constructive feedback.
>
> Does it mean that a special tag should be added to a commit message?
No need for resend, I'll add some more notes at merging.
thanks,
Takashi
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
@ 2017-09-07 8:09 ` Takashi Iwai
0 siblings, 0 replies; 30+ messages in thread
From: Takashi Iwai @ 2017-09-07 8:09 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Dan Carpenter, Bhumika Goyal, Ingo Molnar,
Jaroslav Kysela, David Howells, kernel-janitors, LKML
On Thu, 07 Sep 2017 09:41:39 +0200,
SF Markus Elfring wrote:
>
> >> @@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
> >> legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
> >> pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
> >> } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
> >> - snd_card_free(card);
> > ^^^^^^^^^^^^^^^^^^^
> >> dev_err(card->dev, "cannot create opl3 hwdep\n");
> > ^^^^^^^^^
> >> - return err;
> >> + goto free_card;
> >
> > Heh. I was worried that some of these re-orderings would introduce bugs
> > but actually this one fixes a use after free.
>
> Thanks for your constructive feedback.
>
> Does it mean that a special tag should be added to a commit message?
No need for resend, I'll add some more notes at merging.
thanks,
Takashi
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
@ 2017-09-07 8:09 ` Takashi Iwai
0 siblings, 0 replies; 30+ messages in thread
From: Takashi Iwai @ 2017-09-07 8:09 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Dan Carpenter, Bhumika Goyal, Ingo Molnar,
Jaroslav Kysela, David Howells, kernel-janitors, LKML
On Thu, 07 Sep 2017 09:41:39 +0200,
SF Markus Elfring wrote:
>
> >> @@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
> >> legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
> >> pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
> >> } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
> >> - snd_card_free(card);
> > ^^^^^^^^^^^^^^^^^^^
> >> dev_err(card->dev, "cannot create opl3 hwdep\n");
> > ^^^^^^^^^
> >> - return err;
> >> + goto free_card;
> >
> > Heh. I was worried that some of these re-orderings would introduce bugs
> > but actually this one fixes a use after free.
>
> Thanks for your constructive feedback.
>
> Does it mean that a special tag should be added to a commit message?
No need for resend, I'll add some more notes at merging.
thanks,
Takashi
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 3/3] ALSA: ymfpci: Adjust 17 checks for null pointers
2017-09-06 19:50 ` SF Markus Elfring
(?)
@ 2017-09-07 8:35 ` Takashi Iwai
-1 siblings, 0 replies; 30+ messages in thread
From: Takashi Iwai @ 2017-09-07 8:35 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Bhumika Goyal, Ingo Molnar, Jaroslav Kysela,
David Howells, kernel-janitors, LKML
On Wed, 06 Sep 2017 21:50:09 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 6 Sep 2017 21:30:37 +0200
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> The script “checkpatch.pl” pointed information out like the following.
>
> Comparison to NULL could be written …
>
> Thus fix affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
I don't find such a change is needed at all.
Skipped.
Takashi
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 3/3] ALSA: ymfpci: Adjust 17 checks for null pointers
@ 2017-09-07 8:35 ` Takashi Iwai
0 siblings, 0 replies; 30+ messages in thread
From: Takashi Iwai @ 2017-09-07 8:35 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Bhumika Goyal, Ingo Molnar, Jaroslav Kysela,
David Howells, kernel-janitors, LKML
On Wed, 06 Sep 2017 21:50:09 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 6 Sep 2017 21:30:37 +0200
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> The script “checkpatch.pl” pointed information out like the following.
>
> Comparison to NULL could be written …
>
> Thus fix affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
I don't find such a change is needed at all.
Skipped.
Takashi
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 3/3] ALSA: ymfpci: Adjust 17 checks for null pointers
@ 2017-09-07 8:35 ` Takashi Iwai
0 siblings, 0 replies; 30+ messages in thread
From: Takashi Iwai @ 2017-09-07 8:35 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Bhumika Goyal, Ingo Molnar, Jaroslav Kysela,
David Howells, kernel-janitors, LKML
On Wed, 06 Sep 2017 21:50:09 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 6 Sep 2017 21:30:37 +0200
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> The script “checkpatch.pl” pointed information out like the following.
>
> Comparison to NULL could be written …
>
> Thus fix affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
I don't find such a change is needed at all.
Skipped.
Takashi
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
2017-09-06 19:46 ` SF Markus Elfring
(?)
@ 2017-09-07 8:35 ` Takashi Iwai
-1 siblings, 0 replies; 30+ messages in thread
From: Takashi Iwai @ 2017-09-07 8:35 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Bhumika Goyal, Ingo Molnar, Jaroslav Kysela,
David Howells, kernel-janitors, LKML
On Wed, 06 Sep 2017 21:46:52 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 6 Sep 2017 20:45:11 +0200
>
> * Add a jump target so that a bit of exception handling can be better
> reused at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> * The script "checkpatch.pl" pointed information out like the following.
>
> ERROR: do not use assignment in if condition
>
> Thus fix a few source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied now. Thanks.
Takashi
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
@ 2017-09-07 8:35 ` Takashi Iwai
0 siblings, 0 replies; 30+ messages in thread
From: Takashi Iwai @ 2017-09-07 8:35 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Bhumika Goyal, Ingo Molnar, Jaroslav Kysela,
David Howells, kernel-janitors, LKML
On Wed, 06 Sep 2017 21:46:52 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 6 Sep 2017 20:45:11 +0200
>
> * Add a jump target so that a bit of exception handling can be better
> reused at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> * The script "checkpatch.pl" pointed information out like the following.
>
> ERROR: do not use assignment in if condition
>
> Thus fix a few source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied now. Thanks.
Takashi
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
@ 2017-09-07 8:35 ` Takashi Iwai
0 siblings, 0 replies; 30+ messages in thread
From: Takashi Iwai @ 2017-09-07 8:35 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Bhumika Goyal, Ingo Molnar, Jaroslav Kysela,
David Howells, kernel-janitors, LKML
On Wed, 06 Sep 2017 21:46:52 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 6 Sep 2017 20:45:11 +0200
>
> * Add a jump target so that a bit of exception handling can be better
> reused at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> * The script "checkpatch.pl" pointed information out like the following.
>
> ERROR: do not use assignment in if condition
>
> Thus fix a few source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied now. Thanks.
Takashi
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 2/3] ALSA: ymfpci: Use common error handling code in snd_ymfpci_create()
2017-09-06 19:48 ` SF Markus Elfring
(?)
@ 2017-09-07 8:35 ` Takashi Iwai
-1 siblings, 0 replies; 30+ messages in thread
From: Takashi Iwai @ 2017-09-07 8:35 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Bhumika Goyal, Ingo Molnar, Jaroslav Kysela,
David Howells, kernel-janitors, LKML
On Wed, 06 Sep 2017 21:48:11 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 6 Sep 2017 21:12:51 +0200
>
> * Add a jump target so that a bit of exception handling can be better
> reused at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> * The script "checkpatch.pl" pointed information out like the following.
>
> ERROR: do not use assignment in if condition
>
> Thus fix a few source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 2/3] ALSA: ymfpci: Use common error handling code in snd_ymfpci_create()
@ 2017-09-07 8:35 ` Takashi Iwai
0 siblings, 0 replies; 30+ messages in thread
From: Takashi Iwai @ 2017-09-07 8:35 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, kernel-janitors, LKML, David Howells, Ingo Molnar,
Bhumika Goyal
On Wed, 06 Sep 2017 21:48:11 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 6 Sep 2017 21:12:51 +0200
>
> * Add a jump target so that a bit of exception handling can be better
> reused at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> * The script "checkpatch.pl" pointed information out like the following.
>
> ERROR: do not use assignment in if condition
>
> Thus fix a few source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 2/3] ALSA: ymfpci: Use common error handling code in snd_ymfpci_create()
@ 2017-09-07 8:35 ` Takashi Iwai
0 siblings, 0 replies; 30+ messages in thread
From: Takashi Iwai @ 2017-09-07 8:35 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, kernel-janitors, LKML, David Howells, Ingo Molnar,
Bhumika Goyal
On Wed, 06 Sep 2017 21:48:11 +0200,
SF Markus Elfring wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 6 Sep 2017 21:12:51 +0200
>
> * Add a jump target so that a bit of exception handling can be better
> reused at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> * The script "checkpatch.pl" pointed information out like the following.
>
> ERROR: do not use assignment in if condition
>
> Thus fix a few source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2017-09-07 8:35 UTC | newest]
Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-06 19:45 [PATCH 0/3] ALSA: ymfpci: Fine-tuning for some function implementations SF Markus Elfring
2017-09-06 19:45 ` SF Markus Elfring
2017-09-06 19:45 ` SF Markus Elfring
2017-09-06 19:46 ` [PATCH 1/3] ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe() SF Markus Elfring
2017-09-06 19:46 ` SF Markus Elfring
2017-09-06 19:46 ` SF Markus Elfring
2017-09-06 21:51 ` Dan Carpenter
2017-09-06 21:51 ` Dan Carpenter
2017-09-06 21:51 ` Dan Carpenter
2017-09-07 7:41 ` SF Markus Elfring
2017-09-07 7:41 ` SF Markus Elfring
2017-09-07 7:41 ` SF Markus Elfring
2017-09-07 8:09 ` Takashi Iwai
2017-09-07 8:09 ` Takashi Iwai
2017-09-07 8:09 ` Takashi Iwai
2017-09-07 8:35 ` Takashi Iwai
2017-09-07 8:35 ` Takashi Iwai
2017-09-07 8:35 ` Takashi Iwai
2017-09-06 19:48 ` [PATCH 2/3] ALSA: ymfpci: Use common error handling code in snd_ymfpci_create() SF Markus Elfring
2017-09-06 19:48 ` SF Markus Elfring
2017-09-06 19:48 ` SF Markus Elfring
2017-09-07 8:35 ` Takashi Iwai
2017-09-07 8:35 ` Takashi Iwai
2017-09-07 8:35 ` Takashi Iwai
2017-09-06 19:50 ` [PATCH 3/3] ALSA: ymfpci: Adjust 17 checks for null pointers SF Markus Elfring
2017-09-06 19:50 ` SF Markus Elfring
2017-09-06 19:50 ` SF Markus Elfring
2017-09-07 8:35 ` Takashi Iwai
2017-09-07 8:35 ` Takashi Iwai
2017-09-07 8:35 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.