From: Takashi Iwai Date: Sun, 04 Jan 2015 14:18:57 +0000 Subject: Re: [PATCH 12/13] ALSA: msnd: One function call less in snd_msnd_attach() after error detection Message-Id: List-Id: References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <54A9355F.4050102@users.sourceforge.net> <54A9425E.1030107@users.sourceforge.net> In-Reply-To: <54A9425E.1030107@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: SF Markus Elfring Cc: Julia Lawall , alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org, LKML At Sun, 04 Jan 2015 14:38:38 +0100, SF Markus Elfring wrote: > > From: Markus Elfring > 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 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 >