Re: [PATCH net 1/2] net/mlx5: Fix memory leak in cmd_exec()

From: Markus Elfring
Date: Sun Jul 20 2025 - 08:15:45 EST



> +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
> @@ -1947,8 +1947,8 @@ static int cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
>
> err = mlx5_cmd_invoke(dev, inb, outb, out, out_size, callback, context,
> pages_queue, token, force_polling);
> - if (callback)
> - return err;
> + if (callback && !err)

Can an other order become more appropriate for the items of this condition check?


> + return 0;
>
> if (err > 0) /* Failed in FW, command didn't execute */
> err = deliv_status_to_err(err);


Regards,
Markus