Skip to contentSkip to conversation

staging: solo6x10: fix | vs &

RFC PATCH In review Dan Carpenter 2 participants 3 messages Jun 9, 2012 – Jun 15, 2012

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

RFC PATCH 1/1 staging: solo6x10: fix | vs &

The test here is never true because '&' was used instead of '|'. It was the same as:

	if (status & ((1<<16) & (1<<17)) ...

---
I don't have this hardware and this one really should be tested or checked by someone who knows the spec. It could be that the intent was to do:

	if ((status & SOLO_IIC_STATE_TRNS) &&
	    (status & SOLO_IIC_STATE_SIG_ERR) || ...
drivers/staging/media/solo6x10/i2c.c +1 -1
index ef95a50..398070a 100644
@@ -175,7 +175,7 @@ int solo_i2c_isr(struct solo_dev *solo_dev)
 
 	solo_reg_write(solo_dev, SOLO_IRQ_STAT, SOLO_IRQ_IIC);
 
-	if (status & (SOLO_IIC_STATE_TRNS & SOLO_IIC_STATE_SIG_ERR) ||
+	if (status & (SOLO_IIC_STATE_TRNS | SOLO_IIC_STATE_SIG_ERR) ||
 	    solo_dev->i2c_id < 0) {
 		solo_i2c_stop(solo_dev);
 		return -ENXIO;
#1 lore raw
Quoted 5 lines · Dan Carpenter

The test here is never true because '&' was used instead of '|'. It was the same as:

	if (status & ((1<<16) & (1<<17)) ...
Quoted 9 lines

---
I don't have this hardware and this one really should be tested or checked by someone who knows the spec. It could be that the intent was to do:

	if ((status & SOLO_IIC_STATE_TRNS) &&
	    (status & SOLO_IIC_STATE_SIG_ERR) || ...

It should be this, yes? For other similar mistakes it was meant to be this way.

regards,
dan carpenter

#2 lore raw
Quoted 12 lines · Dan Carpenter
Quoted 11 lines · Dan Carpenter

The test here is never true because '&' was used instead of '|'. It was the same as:

	if (status & ((1<<16) & (1<<17)) ...

---
I don't have this hardware and this one really should be tested or checked by someone who knows the spec. It could be that the intent was to do:

Quoted 6 lines
Quoted 3 lines
	if ((status & SOLO_IIC_STATE_TRNS) &&
	    (status & SOLO_IIC_STATE_SIG_ERR) || ...

It should be this, yes? For other similar mistakes it was meant to be this way.

Yes, looks ok.

Regards,
Ralph