]> www.infradead.org Git - users/willy/xarray.git/commit
dpaa2-switch: Fix error checking in dpaa2_switch_seed_bp()
authorDan Carpenter <dan.carpenter@linaro.org>
Sat, 17 Aug 2024 06:52:46 +0000 (09:52 +0300)
committerJakub Kicinski <kuba@kernel.org>
Tue, 20 Aug 2024 22:17:17 +0000 (15:17 -0700)
commitc50e7475961c36ec4d21d60af055b32f9436b431
tree79c5c2a3a85d62861a56cc32020ce0c2e59674f4
parent7565c39da89dc6ac9b1b0733bd70276bc66612b1
dpaa2-switch: Fix error checking in dpaa2_switch_seed_bp()

The dpaa2_switch_add_bufs() function returns the number of bufs that it
was able to add.  It returns BUFS_PER_CMD (7) for complete success or a
smaller number if there are not enough pages available.  However, the
error checking is looking at the total number of bufs instead of the
number which were added on this iteration.  Thus the error checking
only works correctly for the first iteration through the loop and
subsequent iterations are always counted as a success.

Fix this by checking only the bufs added in the current iteration.

Fixes: 0b1b71370458 ("staging: dpaa2-switch: handle Rx path on control interface")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://patch.msgid.link/eec27f30-b43f-42b6-b8ee-04a6f83423b6@stanley.mountain
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c