Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Danil Kipnis <danil.kipnis@cloud.ionos.com>,
	Jack Wang <jinpu.wang@cloud.ionos.com>,
	Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@ziepe.ca>
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: Re: [PATCH] RDMA/rtrs: client: Fix function return on success
Date: Tue, 19 May 2020 09:16:05 -0700	[thread overview]
Message-ID: <220e3cd2-2f22-063a-4117-8ee987521c61@acm.org> (raw)
In-Reply-To: <20200519161345.GA3910@embeddedor>

On 2020-05-19 09:13, Gustavo A. R. Silva wrote:
> The function should return 0 on success, instead of err.
> 
> Addresses-Coverity-ID: 1493753 ("Identical code for different branches")
> Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality")
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>  drivers/infiniband/ulp/rtrs/rtrs-clt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> index 468fdd0d8713c..465515e46bb1a 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> @@ -1594,7 +1594,8 @@ static int create_con_cq_qp(struct rtrs_clt_con *con)
>  
>  	if (err)
>  		return err;
> -	return err;
> +
> +	return 0;
>  }

Why to keep the if-statement? Has the following been considered?

diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index 8dfa56dc32bc..a7f5d55f8542 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -1587,8 +1587,6 @@ static int create_con_cq_qp(struct rtrs_clt_con *con)
 	 * since destroy_con_cq_qp() must be called.
 	 */

-	if (err)
-		return err;
 	return err;
 }

Thanks,

Bart.

  reply	other threads:[~2020-05-19 16:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 16:13 [PATCH] RDMA/rtrs: client: Fix function return on success Gustavo A. R. Silva
2020-05-19 16:16 ` Bart Van Assche [this message]
2020-05-19 16:21   ` Jinpu Wang

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=220e3cd2-2f22-063a-4117-8ee987521c61@acm.org \
    --to=bvanassche@acm.org \
    --cc=danil.kipnis@cloud.ionos.com \
    --cc=dledford@redhat.com \
    --cc=gustavo@embeddedor.com \
    --cc=gustavoars@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /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