Skip to contentSkip to conversation

i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition

PATCH Applied Maxime Ripard 3 participants 4 messages Feb 25, 2021 – Feb 26, 2021

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

PATCH 1/1 i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition

The brcmstb_send_i2c_cmd currently has a condition that is (CMD_RD || CMD_WR) which always evaluates to true, while the obvious fix is to test whether the cmd variable passed as parameter holds one of these two values.

---
 drivers/i2c/busses/i2c-brcmstb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-brcmstb.c +1 -1
index d4e0a0f6732a..ba766d24219e 100644
@@ -316,7 +316,7 @@ static int brcmstb_send_i2c_cmd(struct brcmstb_i2c_dev *dev,
 		goto cmd_out;
 	}
 
-	if ((CMD_RD || CMD_WR) &&
+	if ((cmd == CMD_RD || cmd == CMD_WR) &&
 	    bsc_readl(dev, iic_enable) & BSC_IIC_EN_NOACK_MASK) {
 		rc = -EREMOTEIO;
 		dev_dbg(dev->device, "controller received NOACK intr for %s\n",
Signature · 1 line
2.29.2
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Maxime Ripard

The brcmstb_send_i2c_cmd currently has a condition that is (CMD_RD || CMD_WR) which always evaluates to true, while the obvious fix is to test whether the cmd variable passed as parameter holds one of these two values.

Fixes dd1aa2524bc5 ("i2c: brcmstb: Add Broadcom settop SoC i2c

controller driver")

Thanks!

Signature · 1 line
Florian
#2 lore raw
In reply to Maxime Ripard
Quoted 7 lines · Maxime Ripard

The brcmstb_send_i2c_cmd currently has a condition that is (CMD_RD || CMD_WR) which always evaluates to true, while the obvious fix is to test whether the cmd variable passed as parameter holds one of these two values.

I got a feeling of deja vu...

... and, in deed, I already fixed this, too, one year ago:

http://patchwork.ozlabs.org/project/linux-i2c/patch/[email protected]/

Dunno why it never appeared in a pull request :(

I'll pick this one, now!