From: Jason Gunthorpe <jgg@ziepe.ca>
To: Max Hirsch <max.hirsch@gmail.com>
Cc: Doug Ledford <dledford@redhat.com>,
Parav Pandit <parav@mellanox.com>,
Leon Romanovsky <leon@kernel.org>,
Steve Wise <swise@opengridcomputing.com>,
Bart Van Assche <bvanassche@acm.org>,
Danit Goldberg <danitg@mellanox.com>,
Matthew Wilcox <willy@infradead.org>,
Dag Moxnes <dag.moxnes@oracle.com>,
Myungho Jung <mhjungk@gmail.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/cma: Fix checkpatch error
Date: Wed, 11 Dec 2019 12:26:54 -0400 [thread overview]
Message-ID: <20191211162654.GD6622@ziepe.ca> (raw)
In-Reply-To: <20191211111628.2955-1-max.hirsch@gmail.com>
On Wed, Dec 11, 2019 at 11:16:26AM +0000, Max Hirsch wrote:
> When running checkpatch on cma.c the following error was found:
I think checkpatch will complain about your patch, did you run it?
> ERROR: do not use assignment in if condition
> #413: FILE: drivers/infiniband/tmp.c:413:
> + if ((ret = (id_priv->state == comp)))
>
> This patch moves the assignment of ret to the previous line. The if statement then checks the value of ret assigned on the previous line. The assigned value of ret is not changed. Testing involved recompiling and loading the kernel. After the changes checkpatch does not report this the error in cma.c.
>
> Signed-off-by: Max Hirsch <max.hirsch@gmail.com>
> drivers/infiniband/core/cma.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
> index 25f2b70fd8ef..bdb7a8493517 100644
> +++ b/drivers/infiniband/core/cma.c
> @@ -410,7 +410,8 @@ static int cma_comp_exch(struct rdma_id_private *id_priv,
> int ret;
>
> spin_lock_irqsave(&id_priv->lock, flags);
> - if ((ret = (id_priv->state == comp)))
> + ret = (id_priv->state == comp);
Brackets are not needed
Ret and the return result should be changed to a bool
Jason
next prev parent reply other threads:[~2019-12-11 16:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 11:16 [PATCH] RDMA/cma: Fix checkpatch error Max Hirsch
2019-12-11 16:26 ` Jason Gunthorpe [this message]
2019-12-12 1:33 ` Max Hirsch
2019-12-18 12:52 ` Jason Gunthorpe
2019-12-12 8:49 ` Leon Romanovsky
2019-12-12 12:10 ` Gal Pressman
2019-12-12 12:28 ` Max Hirsch
2019-12-12 13:47 ` Leon Romanovsky
2019-12-12 13:41 ` Leon Romanovsky
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=20191211162654.GD6622@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=bvanassche@acm.org \
--cc=dag.moxnes@oracle.com \
--cc=danitg@mellanox.com \
--cc=dledford@redhat.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=max.hirsch@gmail.com \
--cc=mhjungk@gmail.com \
--cc=parav@mellanox.com \
--cc=swise@opengridcomputing.com \
--cc=willy@infradead.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