Skip to content

Commit c584c4f

Browse files
ConchuODAndi Shyti
authored andcommitted
i2c: microchip-core: re-fix fake detections w/ i2cdetect
Introducing support for smbus re-broke i2cdetect, causing it to detect devices at every i2c address, just as it did prior to being fixed in commit 49e1f0f ("i2c: microchip-core: fix "ghost" detections"). This was caused by an oversight, where the new smbus code failed to check the return value of mchp_corei2c_xfer(). Check it, and propagate any errors. Fixes: d6ceb40 ("i2c: microchip-corei2c: add smbus support") Signed-off-by: Conor Dooley <[email protected]> Signed-off-by: Andi Shyti <[email protected]> Link: https://lore.kernel.org/r/20250630-shopper-proven-500f4075e7d6@spud
1 parent 3d30048 commit c584c4f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/i2c/busses/i2c-microchip-corei2c.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ static int mchp_corei2c_smbus_xfer(struct i2c_adapter *adap, u16 addr, unsigned
435435
u8 tx_buf[I2C_SMBUS_BLOCK_MAX + 2];
436436
u8 rx_buf[I2C_SMBUS_BLOCK_MAX + 1];
437437
int num_msgs = 1;
438+
int ret;
438439

439440
msgs[CORE_I2C_SMBUS_MSG_WR].addr = addr;
440441
msgs[CORE_I2C_SMBUS_MSG_WR].flags = 0;
@@ -505,7 +506,10 @@ static int mchp_corei2c_smbus_xfer(struct i2c_adapter *adap, u16 addr, unsigned
505506
return -EOPNOTSUPP;
506507
}
507508

508-
mchp_corei2c_xfer(&idev->adapter, msgs, num_msgs);
509+
ret = mchp_corei2c_xfer(&idev->adapter, msgs, num_msgs);
510+
if (ret < 0)
511+
return ret;
512+
509513
if (read_write == I2C_SMBUS_WRITE || size <= I2C_SMBUS_BYTE_DATA)
510514
return 0;
511515

0 commit comments

Comments
 (0)