[PATCH RESEND v1 1/3] i2c: mlxbf: Fix master GW corruption from unmasked SMBus flags

From: Chris Babroski

Date: Fri Nov 20 2026 - 14:51:35 EST


When the MLXBF_I2C_F_SMBUS_BLOCK and/or MLXBF_I2C_F_SMBUS_PEC flags are
set, the flag bitmask values are shifted and written to the master
gateway control register instead of the single-bit flag values. Shifting
and writing the bitmasks can corrupt adjacent bits in the master gateway
control register like the slave address used in read phases.

Convert the SMBus flags to boolean values before setting the master
gateway control register.

Signed-off-by: Chris Babroski <cbabroski@xxxxxxxxxx>
---
drivers/i2c/busses/i2c-mlxbf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c
index 432d9588f32d..375cbbce0fad 100644
--- a/drivers/i2c/busses/i2c-mlxbf.c
+++ b/drivers/i2c/busses/i2c-mlxbf.c
@@ -740,8 +740,8 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv,
* submitted by the first operation only.
*/
if (op_idx == 0 && flags & MLXBF_I2C_F_SMBUS_OPERATION) {
- block_en = flags & MLXBF_I2C_F_SMBUS_BLOCK;
- pec_en = flags & MLXBF_I2C_F_SMBUS_PEC;
+ block_en = !!(flags & MLXBF_I2C_F_SMBUS_BLOCK);
+ pec_en = !!(flags & MLXBF_I2C_F_SMBUS_PEC);
}

if (flags & MLXBF_I2C_F_WRITE) {
--
2.34.1