Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1740578 > unrolled thread

Re: [PATCH] [media] bt8xx: Use common error handling code in two functions

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2017-09-27 12:00 +0200
Last post2017-09-27 12:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] [media] bt8xx: Use common error handling code in two  functions Dan Carpenter <dan.carpenter@oracle.com> - 2017-09-27 12:00 +0200

#1740578 — Re: [PATCH] [media] bt8xx: Use common error handling code in two functions

FromDan Carpenter <dan.carpenter@oracle.com>
Date2017-09-27 12:00 +0200
SubjectRe: [PATCH] [media] bt8xx: Use common error handling code in two functions
Message-ID<uuhii-E8-9@gated-at.bofh.it>
On Mon, Sep 25, 2017 at 10:18:29PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.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@users.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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web