[PATCH 13/13] ALSA: msnd: Fix centralized exiting from snd_msnd_attach()

From: SF Markus Elfring
Date: Sun Jan 04 2015 - 08:41:50 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/