All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Julia Lawall <julia@diku.dk>
Cc: Chas Williams <chas@cmf.nrl.navy.mil>,
	kernel-janitors@vger.kernel.org,
	linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] drivers/atm/idt77252.c: Remove unnecessary error
Date: Sat, 02 Oct 2010 14:09:42 +0000	[thread overview]
Message-ID: <4CA73D26.7090109@bfs.de> (raw)
In-Reply-To: <1286027958-7333-4-git-send-email-julia@diku.dk>



Julia Lawall schrieb:
> This code does not call deinit_card(card); in an error case, as done in
> other error-handling code in the same function.  But actually, the called
> function init_sram can only return 0, so there is no need for the error
> check at all.
> 


did you set init_sram() to void ?
re,
 wh




> A simplified version of the sematic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @r exists@
> @r@
> statement S1,S2,S3;
> constant C1,C2,C3;
> @@
> 
> *if (...)
>  {... S1 return -C1;}
> ...
> *if (...)
>  {... when != S1
>     return -C2;}
> ...
> *if (...)
>  {... S1 return -C3;}
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>
> 
> ---
>  drivers/atm/idt77252.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
> index 1679cbf..08ccde6 100644
> --- a/drivers/atm/idt77252.c
> +++ b/drivers/atm/idt77252.c
> @@ -3410,8 +3410,7 @@ init_card(struct atm_dev *dev)
>  
>  	writel(readl(SAR_REG_CFG) | conf, SAR_REG_CFG);
>  
> -	if (init_sram(card) < 0)
> -		return -1;
> +	init_sram(card);
>  
>  /********************************************************************/
>  /*  A L L O C   R A M   A N D   S E T   V A R I O U S   T H I N G S */
> 
> --
> 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
> 
> 

WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Julia Lawall <julia@diku.dk>
Cc: Chas Williams <chas@cmf.nrl.navy.mil>,
	kernel-janitors@vger.kernel.org,
	linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] drivers/atm/idt77252.c: Remove unnecessary error check
Date: Sat, 02 Oct 2010 16:09:42 +0200	[thread overview]
Message-ID: <4CA73D26.7090109@bfs.de> (raw)
In-Reply-To: <1286027958-7333-4-git-send-email-julia@diku.dk>



Julia Lawall schrieb:
> This code does not call deinit_card(card); in an error case, as done in
> other error-handling code in the same function.  But actually, the called
> function init_sram can only return 0, so there is no need for the error
> check at all.
> 


did you set init_sram() to void ?
re,
 wh




> A simplified version of the sematic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @r exists@
> @r@
> statement S1,S2,S3;
> constant C1,C2,C3;
> @@
> 
> *if (...)
>  {... S1 return -C1;}
> ...
> *if (...)
>  {... when != S1
>     return -C2;}
> ...
> *if (...)
>  {... S1 return -C3;}
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>
> 
> ---
>  drivers/atm/idt77252.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
> index 1679cbf..08ccde6 100644
> --- a/drivers/atm/idt77252.c
> +++ b/drivers/atm/idt77252.c
> @@ -3410,8 +3410,7 @@ init_card(struct atm_dev *dev)
>  
>  	writel(readl(SAR_REG_CFG) | conf, SAR_REG_CFG);
>  
> -	if (init_sram(card) < 0)
> -		return -1;
> +	init_sram(card);
>  
>  /********************************************************************/
>  /*  A L L O C   R A M   A N D   S E T   V A R I O U S   T H I N G S */
> 
> --
> 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
> 
> 

  reply	other threads:[~2010-10-02 14:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-02 13:59 [PATCH 4/4] drivers/atm/idt77252.c: Remove unnecessary error check Julia Lawall
2010-10-02 13:59 ` Julia Lawall
2010-10-02 14:09 ` walter harms [this message]
2010-10-02 14:09   ` walter harms
2010-10-02 14:21   ` [PATCH 4/4] drivers/atm/idt77252.c: Remove unnecessary error Julia Lawall
2010-10-02 14:21     ` [PATCH 4/4] drivers/atm/idt77252.c: Remove unnecessary error check Julia Lawall
2010-10-02 14:37   ` [PATCH 4/4] drivers/atm/idt77252.c: Remove unnecessary error Julia Lawall
2010-10-02 14:37     ` [PATCH 4/4] drivers/atm/idt77252.c: Remove unnecessary error check Julia Lawall
2010-10-04  5:06     ` [PATCH 4/4] drivers/atm/idt77252.c: Remove unnecessary error David Miller
2010-10-04  5:06       ` [PATCH 4/4] drivers/atm/idt77252.c: Remove unnecessary error check David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CA73D26.7090109@bfs.de \
    --to=wharms@bfs.de \
    --cc=chas@cmf.nrl.navy.mil \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-atm-general@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.