[PATCH v2 1/4] i2c: smbus: only limit max banks to eight

From: Thomas Weißschuh
Date: Thu Jun 27 2024 - 13:48:33 EST


If there are less than eight slots in total,
only probe those.
Now the code matches the comment "..., then limit slots to 8".

Fixes: 8821c8376993 ("i2c: smbus: Prepare i2c_register_spd for usage on muxed segments")
Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
drivers/i2c/i2c-smbus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
index f809f0ef2004..8f0403652606 100644
--- a/drivers/i2c/i2c-smbus.c
+++ b/drivers/i2c/i2c-smbus.c
@@ -356,7 +356,7 @@ void i2c_register_spd(struct i2c_adapter *adap)
* as this is the max number of SPD EEPROMs that can be addressed per bus.
*/
if (i2c_parent_is_i2c_adapter(adap)) {
- slot_count = 8;
+ slot_count = min(slot_count, 8);
} else {
if (slot_count > 8) {
dev_warn(&adap->dev,

--
2.45.2