public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Jia-Ju Bai <baijiaju1990@gmail.com>,
	borisp@nvidia.com, saeedm@nvidia.com, leon@kernel.org,
	davem@davemloft.net, kuba@kernel.org
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: mellanox: mlx5: fix error return code in mlx5_fpga_device_start()
Date: Thu, 4 Mar 2021 20:58:24 +0100	[thread overview]
Message-ID: <cac36164-c8d3-415e-ca43-20b16b57b3fc@gmail.com> (raw)
In-Reply-To: <20210304141814.8508-1-baijiaju1990@gmail.com>

On 04.03.2021 15:18, Jia-Ju Bai wrote:
> When mlx5_is_fpga_lookaside() returns a non-zero value, no error 
> return code is assigned.
> To fix this bug, err is assigned with -EINVAL as error return code.
> 
To me it looks like the current behavior is intentional.
Did you verify that it's actually an error condition if the
function returns true? Please don't blindly trust such code checkers.

> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c b/drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c
> index 2ce4241459ce..c9e6da97126f 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c
> @@ -198,8 +198,10 @@ int mlx5_fpga_device_start(struct mlx5_core_dev *mdev)
>  	mlx5_fpga_info(fdev, "FPGA card %s:%u\n", mlx5_fpga_name(fpga_id), fpga_id);
>  
>  	/* No QPs if FPGA does not participate in net processing */
> -	if (mlx5_is_fpga_lookaside(fpga_id))
> +	if (mlx5_is_fpga_lookaside(fpga_id)) {
> +		err = -EINVAL;
>  		goto out;
> +	}
>  
>  	mlx5_fpga_info(fdev, "%s(%d): image, version %u; SBU %06x:%04x version %d\n",
>  		       mlx5_fpga_image_name(fdev->last_oper_image),
> 


  reply	other threads:[~2021-03-04 20:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 14:18 [PATCH] net: mellanox: mlx5: fix error return code in mlx5_fpga_device_start() Jia-Ju Bai
2021-03-04 19:58 ` Heiner Kallweit [this message]
2021-03-07  8:50 ` Leon Romanovsky
2021-03-11 22:51   ` Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cac36164-c8d3-415e-ca43-20b16b57b3fc@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=baijiaju1990@gmail.com \
    --cc=borisp@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox