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] [day] [month] [year] [list]
Message-ID: <20170927095829.gsmjep4frlq4tnzd@mwanda>
Date:   Wed, 27 Sep 2017 12:58:29 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc:     linux-media@...r.kernel.org, Daniele Nicolodi <daniele@...nta.net>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Max Kellermann <max.kellermann@...il.com>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] [media] bt8xx: Use common error handling code in two
 functions

On Mon, Sep 25, 2017 at 10:18:29PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Mon, 25 Sep 2017 22:10:17 +0200
> 
> Adjust jump targets so that a bit of exception handling can be better
> reused at the end of these functions.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  drivers/media/pci/bt8xx/dst.c    | 19 +++++++++++--------
>  drivers/media/pci/bt8xx/dst_ca.c | 30 +++++++++++++++---------------
>  2 files changed, 26 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/media/pci/bt8xx/dst.c b/drivers/media/pci/bt8xx/dst.c
> index 7166d2279465..1290419aca0b 100644
> --- a/drivers/media/pci/bt8xx/dst.c
> +++ b/drivers/media/pci/bt8xx/dst.c
> @@ -134,17 +134,20 @@ EXPORT_SYMBOL(rdc_reset_state);
>  static int rdc_8820_reset(struct dst_state *state)
>  {
>  	dprintk(3, "Resetting DST\n");
> -	if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, 0, NO_DELAY) < 0) {
> -		pr_err("dst_gpio_outb ERROR !\n");
> -		return -1;
> -	}
> +	if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, 0, NO_DELAY)
> +	    < 0)
> +		goto report_failure;
> +
>  	udelay(1000);
> -	if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, RDC_8820_RESET, DELAY) < 0) {
> -		pr_err("dst_gpio_outb ERROR !\n");
> -		return -1;
> -	}
> +	if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET,
> +			  RDC_8820_RESET, DELAY) < 0)
> +		goto report_failure;
>  
>  	return 0;
> +
> +report_failure:
> +	pr_err("dst_gpio_outb ERROR !\n");
> +	return -1;

This code is ugly and this patch doesn't improve it; it just shuffles
it around.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ