lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 04 Jan 2015 15:18:57 +0100
From:	Takashi Iwai <tiwai@...e.de>
To:	SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc:	Jaroslav Kysela <perex@...ex.cz>, alsa-devel@...a-project.org,
	LKML <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org,
	Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 12/13] ALSA: msnd: One function call less in snd_msnd_attach() after error detection

At Sun, 04 Jan 2015 14:38:38 +0100,
SF Markus Elfring wrote:
> 
> From: Markus Elfring <elfring@...rs.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@...rs.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
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ