Re: [bug report] net/mlx4_core: Support more than 64 VFs

Leon Romanovsky
2022-05-23T12:18:42Z

On Fri, Apr 22, 2022 at 06:41:12PM +0300, Dan Carpenter wrote:
> Hello Matan Barak,
>
> The patch de966c592802: "net/mlx4_core: Support more than 64 VFs"
> from Nov 13, 2014, leads to the following Smatch static checker
> warning:
>
> drivers/net/ethernet/mellanox/mlx4/main.c:3455 mlx4_load_one()
> warn: missing error code 'err'
>
> drivers/net/ethernet/mellanox/mlx4/main.c
> 3438 if (mlx4_is_master(dev)) {
> 3439 /* when we hit the goto slave_start below, dev_cap already initialized */
> 3440 if (!dev_cap) {
> 3441 dev_cap = kzalloc(sizeof(*dev_cap), GFP_KERNEL);
> 3442
> 3443 if (!dev_cap) {
> 3444 err = -ENOMEM;
> 3445 goto err_fw;
> 3446 }
> 3447
> 3448 err = mlx4_QUERY_DEV_CAP(dev, dev_cap);
> 3449 if (err) {
> 3450 mlx4_err(dev, "QUERY_DEV_CAP command failed, aborting.\n");
> 3451 goto err_fw;
> 3452 }
> 3453
> 3454 if (mlx4_check_dev_cap(dev, dev_cap, nvfs))
> --> 3455 goto err_fw;
> ^^^^^^^^^^^^
> Should this have an error code?

I don't think so. Failure here means that more than 64 VFs were
requested for unsupported device. In such case, we will perform same
flow as for failure in SR-IOV a couple of lines below - graceful exit.

It is hard to say if it is correct behaviour, but I won't change
anything for such old driver.

Thanks