RE: [PATCH] bnx2x: Fix missing error code in bnx2x_iov_init_one()

From: Sudarsana Reddy Kalluru
Date: Tue May 25 2021 - 08:51:51 EST


> -----Original Message-----
> From: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
> Sent: Tuesday, May 25, 2021 4:30 PM
> To: Ariel Elior <aelior@xxxxxxxxxxx>
> Cc: Sudarsana Reddy Kalluru <skalluru@xxxxxxxxxxx>; GR-everest-linux-l2
> <GR-everest-linux-l2@xxxxxxxxxxx>; davem@xxxxxxxxxxxx;
> kuba@xxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
> Subject: [PATCH] bnx2x: Fix missing error code in bnx2x_iov_init_one()
>
> Eliminate the follow smatch warning:
>
> drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c:1227
> bnx2x_iov_init_one() warn: missing error code 'err'.

Not sure if it's false positive, variable 'err' is initialized at line 1195.
1194
1195 err = -EIO;
1196 /* verify ari is enabled */

[Changes look ok though]

>
> Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
> ---
> drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
> b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
> index d21f085..27943b0 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
> @@ -1223,8 +1223,10 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int
> int_mode_param,
> goto failed;
>
> /* SR-IOV capability was enabled but there are no VFs*/
> - if (iov->total == 0)
> + if (iov->total == 0) {
> + err = -EINVAL;
> goto failed;
> + }
>
> iov->nr_virtfn = min_t(u16, iov->total, num_vfs_param);
>
> --
> 1.8.3.1