]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mlxsw: i2c: Limit single transaction buffer size
authorVadim Pasternak <vadimp@nvidia.com>
Thu, 24 Aug 2023 13:43:09 +0000 (15:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:48:08 +0000 (09:48 +0200)
commit634309d070ab415cf5ce36b2b17b445212d8c308
tree071254d8dbc75adde4571fd9a4447cd5b7e895bd
parentb97bbe83461b5e2e16068aa864c1098c4a88f434
mlxsw: i2c: Limit single transaction buffer size

[ Upstream commit d7248f1cc835bd80e936dc5b2d94b149bdd0077d ]

Maximum size of buffer is obtained from underlying I2C adapter and in
case adapter allows I2C transaction buffer size greater than 100 bytes,
transaction will fail due to firmware limitation.

As a result driver will fail initialization.

Limit the maximum size of transaction buffer by 100 bytes to fit to
firmware.

Remove unnecessary calculation:
max_t(u16, MLXSW_I2C_BLK_DEF, quirk_size).
This condition can not happened.

Fixes: 3029a693beda ("mlxsw: i2c: Allow flexible setting of I2C transactions size")
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/i2c.c