diff mbox

[3/7] drivers/net/atl1c: Remove double test

Message ID 1283010066-20935-4-git-send-email-julia@diku.dk
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Julia Lawall Aug. 28, 2010, 3:41 p.m. UTC
The nic_type field is compared to athr_l2c twice.

The sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression E;
@@

(
* E
  || ... || E
|
* E
  && ... && E
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
This is a guess as to what the code should be.  Perhaps something else
should have been tested instead.

 drivers/net/atl1c/atl1c_hw.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Dan Carpenter Aug. 28, 2010, 4:50 p.m. UTC | #1
I added the Atheros people to the CC list.  Jie Yang should know.

regards,
dan carpenter

On Sat, Aug 28, 2010 at 05:41:02PM +0200, Julia Lawall wrote:
> The nic_type field is compared to athr_l2c twice.
> 
> The sematic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @expression@
> expression E;
> @@
> 
> (
> * E
>   || ... || E
> |
> * E
>   && ... && E
> )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>
> 
> ---
> This is a guess as to what the code should be.  Perhaps something else
> should have been tested instead.
> 
>  drivers/net/atl1c/atl1c_hw.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/atl1c/atl1c_hw.c b/drivers/net/atl1c/atl1c_hw.c
> index d8501f0..919080b 100644
> --- a/drivers/net/atl1c/atl1c_hw.c
> +++ b/drivers/net/atl1c/atl1c_hw.c
> @@ -480,7 +480,7 @@ int atl1c_phy_reset(struct atl1c_hw *hw)
>  		atl1c_write_phy_reg(hw, MII_DBG_DATA, 0x929D);
>  	}
>  	if (hw->nic_type == athr_l1c || hw->nic_type == athr_l2c_b2
> -		|| hw->nic_type == athr_l2c || hw->nic_type == athr_l2c) {
> +		|| hw->nic_type == athr_l2c) {
>  		atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x29);
>  		atl1c_write_phy_reg(hw, MII_DBG_DATA, 0xB6DD);
>  	}
> 
> --
> 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 netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Luis R. Rodriguez Aug. 28, 2010, 8:10 p.m. UTC | #2
On Sat, Aug 28, 2010 at 09:50:14AM -0700, Dan Carpenter wrote:
> I added the Atheros people to the CC list.  Jie Yang should know.
> 
> regards,
> dan carpenter
> 
> On Sat, Aug 28, 2010 at 05:41:02PM +0200, Julia Lawall wrote:
> > The nic_type field is compared to athr_l2c twice.
> > 
> > The sematic match that finds this problem is as follows:
> > (http://coccinelle.lip6.fr/)
> > 
> > // <smpl>
> > @expression@
> > expression E;
> > @@
> > 
> > (
> > * E
> >   || ... || E
> > |
> > * E
> >   && ... && E
> > )
> > // </smpl>
> > 
> > Signed-off-by: Julia Lawall <julia@diku.dk>
> > 
> > ---
> > This is a guess as to what the code should be.  Perhaps something else
> > should have been tested instead.
> > 
> >  drivers/net/atl1c/atl1c_hw.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/atl1c/atl1c_hw.c b/drivers/net/atl1c/atl1c_hw.c
> > index d8501f0..919080b 100644
> > --- a/drivers/net/atl1c/atl1c_hw.c
> > +++ b/drivers/net/atl1c/atl1c_hw.c
> > @@ -480,7 +480,7 @@ int atl1c_phy_reset(struct atl1c_hw *hw)
> >  		atl1c_write_phy_reg(hw, MII_DBG_DATA, 0x929D);
> >  	}
> >  	if (hw->nic_type == athr_l1c || hw->nic_type == athr_l2c_b2
> > -		|| hw->nic_type == athr_l2c || hw->nic_type == athr_l2c) {
> > +		|| hw->nic_type == athr_l2c) {
> >  		atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x29);
> >  		atl1c_write_phy_reg(hw, MII_DBG_DATA, 0xB6DD);
> >  	}

The patch is pretty obvious. Looks good.

  Luis
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/atl1c/atl1c_hw.c b/drivers/net/atl1c/atl1c_hw.c
index d8501f0..919080b 100644
--- a/drivers/net/atl1c/atl1c_hw.c
+++ b/drivers/net/atl1c/atl1c_hw.c
@@ -480,7 +480,7 @@  int atl1c_phy_reset(struct atl1c_hw *hw)
 		atl1c_write_phy_reg(hw, MII_DBG_DATA, 0x929D);
 	}
 	if (hw->nic_type == athr_l1c || hw->nic_type == athr_l2c_b2
-		|| hw->nic_type == athr_l2c || hw->nic_type == athr_l2c) {
+		|| hw->nic_type == athr_l2c) {
 		atl1c_write_phy_reg(hw, MII_DBG_ADDR, 0x29);
 		atl1c_write_phy_reg(hw, MII_DBG_DATA, 0xB6DD);
 	}