Re: [PATCH net] dpaa2-switch: Fix error checking in dpaa2_switch_seed_bp()
From: Simon Horman
Date: Mon Aug 19 2024 - 05:32:06 EST
On Sat, Aug 17, 2024 at 09:52:46AM +0300, Dan Carpenter wrote:
> 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@xxxxxxxxxx>
> ---
> >From reviewing the code. Not tested.
Reviewed-by: Simon Horman <horms@xxxxxxxxxx>