Skip to content

Commit

Permalink
RDMA/cma: Fix checkpatch error
Browse files Browse the repository at this point in the history
When running checkpatch on cma.c the following error was found:

ERROR: do not use assignment in if condition
torvalds#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>
  • Loading branch information
Max Hirsch authored and intel-lab-lkp committed Dec 12, 2019
1 parent e42617b commit 924f4f2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/infiniband/core/cma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
if (ret)
id_priv->state = exch;
spin_unlock_irqrestore(&id_priv->lock, flags);
return ret;
Expand Down

0 comments on commit 924f4f2

Please sign in to comment.