]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mlxsw: i2c: Fix chunk size setting in output mailbox buffer
authorVadim Pasternak <vadimp@nvidia.com>
Thu, 24 Aug 2023 13:43:08 +0000 (15:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Sep 2023 10:22:34 +0000 (12:22 +0200)
commit7790b6a2f5f0239a832038b267f66d762e28d495
treea364705323837724912d51eff26f4e94d5e2c302
parent510e0cbd6408fc414c7d531cd87aaf75b9b56af1
mlxsw: i2c: Fix chunk size setting in output mailbox buffer

[ Upstream commit 146c7c330507c0384bf29d567186632bfe975927 ]

The driver reads commands output from the output mailbox. If the size
of the output mailbox is not a multiple of the transaction /
block size, then the driver will not issue enough read transactions
to read the entire output, which can result in driver initialization
errors.

Fix by determining the number of transactions using DIV_ROUND_UP().

Fixes: 3029a693beda ("mlxsw: i2c: Allow flexible setting of I2C transactions size")
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@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