Skip to contentSkip to conversation

&&/|| confusion

PATCH In review Roel Kluin 2 participants 3 messages Jan 17, 2009 Hardware monitoring

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 &&/|| confusion

&& / || confusion

---

drivers/hwmon/ltc4245.c +1 -1
index 034b2c5..4a1c9fb 100644
@@ -456,7 +456,7 @@ static int ltc4245_check_control_reg(struct i2c_client *client, u8 reg, u8 bits)
 		voff1 &= bits;
 		voff2 &= bits;
 
-		if (v != voff1 || v != voff2)
+		if (v != voff1 && v != voff2)
 			return -ENODEV;
 	}
 

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

author
#1 lore raw

drivers/hwmon/ltc4245.c static int ltc4245_check_control_reg(struct i2c_client *client, u8 reg, u8 bits) · line 461

Quoted 12 lines · I wrote:
drivers/hwmon/ltc4245.c +1 -1
index 034b2c5..4a1c9fb 100644
@@ -456,7 +456,7 @@ static int ltc4245_check_control_reg(struct i2c_client *client, u8 reg, u8 bits)
 		voff1 &= bits;
 		voff2 &= bits;
 
-		if (v != voff1 || v != voff2)
+		if (v != voff1 && v != voff2)
 			return -ENODEV;
 	}

On second hand I am not so certain this is wrong. If so, sorry for the noise.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#2 lore raw
In reply to Roel Kluin
Quoted 9 lines · Roel Kluin
Quoted 8 lines · I wrote:
drivers/hwmon/ltc4245.c +0 -0
index 034b2c5..4a1c9fb 100644
@@ -456,7 +456,7 @@ static int ltc4245_check_control_reg(struct i2c_client *client, u8 reg, u8 bits)
 		voff1 &= bits;
 		voff2 &= bits;
 
Quoted 7 lines

drivers/hwmon/ltc4245.c static int ltc4245_check_control_reg(struct i2c_client *client, u8 reg, u8 bits) · line 461

Quoted 4 lines
drivers/hwmon/ltc4245.c +1 -1
-		if (v != voff1 || v != voff2)
+		if (v != voff1 && v != voff2)
 			return -ENODEV;
 	}

On second hand I am not so certain this is wrong. If so, sorry for the noise.

The original code looks OK to me.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors