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


Groups > linux.kernel > #1299989

Re: [PATCH] net-libertas: Better exception handling in if_spi_host_to_card_worker()

From Julia Lawall <julia.lawall@lip6.fr>
Newsgroups linux.kernel
Subject Re: [PATCH] net-libertas: Better exception handling in if_spi_host_to_card_worker()
Date 2016-01-01 22:50 +0100
Message-ID <qMfK9-7OB-1@gated-at.bofh.it> (permalink)
References <qEuGl-43C-5@gated-at.bofh.it> <qMfAu-7JT-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On Fri, 1 Jan 2016, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 1 Jan 2016 22:27:20 +0100
> 
> This issue was detected by using the Coccinelle software.
> 
> Move the jump label directly before the desired log statement
> so that the variable "err" will not be checked once more
> after it was determined that a function call failed.

Putting a label inside an if is ugly.

julia

> Use the identifier "report_failure" instead of the label "err".
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/net/wireless/marvell/libertas/if_spi.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/wireless/marvell/libertas/if_spi.c b/drivers/net/wireless/marvell/libertas/if_spi.c
> index 82c0796..c9ae27e 100644
> --- a/drivers/net/wireless/marvell/libertas/if_spi.c
> +++ b/drivers/net/wireless/marvell/libertas/if_spi.c
> @@ -880,18 +880,18 @@ static void if_spi_host_to_card_worker(struct work_struct *work)
>  				&hiStatus);
>  	if (err) {
>  		netdev_err(priv->dev, "I/O error\n");
> -		goto err;
> +		goto report_failure;
>  	}
>  
>  	if (hiStatus & IF_SPI_HIST_CMD_UPLOAD_RDY) {
>  		err = if_spi_c2h_cmd(card);
>  		if (err)
> -			goto err;
> +			goto report_failure;
>  	}
>  	if (hiStatus & IF_SPI_HIST_RX_UPLOAD_RDY) {
>  		err = if_spi_c2h_data(card);
>  		if (err)
> -			goto err;
> +			goto report_failure;
>  	}
>  
>  	/*
> @@ -940,9 +940,10 @@ static void if_spi_host_to_card_worker(struct work_struct *work)
>  	if (hiStatus & IF_SPI_HIST_CARD_EVENT)
>  		if_spi_e2h(card);
>  
> -err:
> -	if (err)
> +	if (err) {
> +report_failure:
>  		netdev_err(priv->dev, "%s: got error %d\n", __func__, err);
> +	}
>  
>  	lbs_deb_leave(LBS_DEB_SPI);
>  }
> -- 
> 2.6.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] net-libertas: Better exception handling in  if_spi_host_to_card_worker() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-01 22:40 +0100
  Re: [PATCH] net-libertas: Better exception handling in  if_spi_host_to_card_worker() Julia Lawall <julia.lawall@lip6.fr> - 2016-01-01 22:50 +0100
  Re: [PATCH] net-libertas: Better exception handling in  if_spi_host_to_card_worker() Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-01-02 00:20 +0100
    Re: [PATCH] net-libertas: Better exception handling in  if_spi_host_to_card_worker() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-02 09:20 +0100
      Re: [PATCH] net-libertas: Better exception handling in  if_spi_host_to_card_worker() Julia Lawall <julia.lawall@lip6.fr> - 2016-01-02 09:30 +0100
        Re: net-libertas: Better exception handling in  if_spi_host_to_card_worker() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-02 10:20 +0100
          Re: net-libertas: Better exception handling in  if_spi_host_to_card_worker() Arend van Spriel <aspriel@gmail.com> - 2016-01-02 11:20 +0100
            Re: net-libertas: Better exception handling in  if_spi_host_to_card_worker() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-02 12:30 +0100
              Re: net-libertas: Better exception handling in  if_spi_host_to_card_worker() Arend van Spriel <aspriel@gmail.com> - 2016-01-03 10:40 +0100
                Re: net-libertas: Better exception handling in  if_spi_host_to_card_worker() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-03 13:20 +0100
                Re: net-libertas: Better exception handling in if_spi_host_to_card_worker() Rafał Miłecki <zajec5@gmail.com> - 2016-01-03 16:20 +0100
                Re: net-libertas: Better exception handling in  if_spi_host_to_card_worker() Arend van Spriel <aspriel@gmail.com> - 2016-01-04 11:10 +0100
                Re: net-libertas: Better exception handling in if_spi_host_to_card_worker() Rafał Miłecki <zajec5@gmail.com> - 2016-01-04 12:20 +0100

csiph-web