Skip to contentSkip to conversation

Staging: et131x: fix | vs & typos

PATCH In review Dan Carpenter 2 participants 2 messages Jun 9, 2012 – Jun 11, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: et131x: fix | vs & typos

These two places seem like they should be using bitwise OR instead of bitwise AND. The first one is a noop which is equivalent to:

	imr |= (0x0100 & 0x0004 & 0x0001);

The second is sets lcr2 to zero instead of just clearing the high bits.

	lcr2 &= (0x00F0 & 0x000F);

---
I don't have this hardware.

drivers/staging/et131x/et131x.c +3 -3
index 5b11c5e..0582183 100644
@@ -1767,8 +1767,8 @@ static void et131x_xcvr_init(struct et131x_adapter *adapter)
 	/* Set the link status interrupt only.  Bad behavior when link status
 	 * and auto neg are set, we run into a nested interrupt problem
 	 */
-	imr |= (ET_PHY_INT_MASK_AUTONEGSTAT &
-		ET_PHY_INT_MASK_LINKSTAT &
+	imr |= (ET_PHY_INT_MASK_AUTONEGSTAT |
+		ET_PHY_INT_MASK_LINKSTAT |
 		ET_PHY_INT_MASK_ENABLE);
 
 	et131x_mii_write(adapter, PHY_INTERRUPT_MASK, imr);
@@ -1784,7 +1784,7 @@ static void et131x_xcvr_init(struct et131x_adapter *adapter)
 	if ((adapter->eeprom_data[1] & 0x4) = 0) {
 		et131x_mii_read(adapter, PHY_LED_2, &lcr2);
 
-		lcr2 &= (ET_LED2_LED_100TX & ET_LED2_LED_1000T);
+		lcr2 &= (ET_LED2_LED_100TX | ET_LED2_LED_1000T);
 		lcr2 |= (LED_VAL_LINKON_ACTIVE << LED_LINK_SHIFT);
 
 		if ((adapter->eeprom_data[1] & 0x8) = 0)
Acked-by on v1 1/1
#1 lore raw
Quoted 29 lines · Dan Carpenter

These two places seem like they should be using bitwise OR instead of bitwise AND.  The first one is a noop which is equivalent to:

       imr |= (0x0100 & 0x0004 & 0x0001);

The second is sets lcr2 to zero instead of just clearing the high bits.

       lcr2 &= (0x00F0 & 0x000F);

---
I don't have this hardware.

drivers/staging/et131x/et131x.c +2 -2
index 5b11c5e..0582183 100644
@@ -1767,8 +1767,8 @@ static void et131x_xcvr_init(struct et131x_adapter *adapter)
        /* Set the link status interrupt only.  Bad behavior when link status
         * and auto neg are set, we run into a nested interrupt problem
         */
-       imr |= (ET_PHY_INT_MASK_AUTONEGSTAT &
-               ET_PHY_INT_MASK_LINKSTAT &
+       imr |= (ET_PHY_INT_MASK_AUTONEGSTAT |
+               ET_PHY_INT_MASK_LINKSTAT |
                ET_PHY_INT_MASK_ENABLE);
 
        et131x_mii_write(adapter, PHY_INTERRUPT_MASK, imr);

drivers/staging/et131x/et131x.c static void et131x_xcvr_init(struct et131x_adapter *adapter) · line 1790

Quoted 8 lines
drivers/staging/et131x/et131x.c +1 -1
@@ -1784,7 +1784,7 @@ static void et131x_xcvr_init(struct et131x_adapter *adapter)
        if ((adapter->eeprom_data[1] & 0x4) = 0) {
                et131x_mii_read(adapter, PHY_LED_2, &lcr2);
 
-               lcr2 &= (ET_LED2_LED_100TX & ET_LED2_LED_1000T);
+               lcr2 &= (ET_LED2_LED_100TX | ET_LED2_LED_1000T);
                lcr2 |= (LED_VAL_LINKON_ACTIVE << LED_LINK_SHIFT);
 
                if ((adapter->eeprom_data[1] & 0x8) = 0)

Good spot. The fix is consistent with the original driver code and tested ok with real hardware.

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