mlxsw: i2c: Limit single transaction buffer size
authorVadim Pasternak <vadimp@nvidia.com>
Thu, 24 Aug 2023 13:43:09 +0000 (15:43 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 25 Aug 2023 09:53:37 +0000 (10:53 +0100)
commitd7248f1cc835bd80e936dc5b2d94b149bdd0077d
treeeb19810caf00e5ed47a9c5e6a453b91c9d8d3d57
parent146c7c330507c0384bf29d567186632bfe975927
mlxsw: i2c: Limit single transaction buffer size

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>
drivers/net/ethernet/mellanox/mlxsw/i2c.c