[PATCH v2 07/17] IB/mlx4: Move an assignment out of a check in forward_trap()

From: SF Markus Elfring
Date: Fri Apr 21 2017 - 14:38:51 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 21 Apr 2017 14:00:08 +0200

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Reviewed-by: Majd Dibbiny <majd@xxxxxxxxxxxx>
---
drivers/infiniband/hw/mlx4/mad.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index 3caf468ca133..0a5b46791335 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -401,7 +401,8 @@ static void forward_trap(struct mlx4_ib_dev *dev, u8 port_num, const struct ib_m
*/
spin_lock_irqsave(&dev->sm_lock, flags);
memcpy(send_buf->mad, mad, sizeof *mad);
- if ((send_buf->ah = dev->sm_ah[port_num - 1]))
+ send_buf->ah = dev->sm_ah[port_num - 1];
+ if (send_buf->ah)
ret = ib_post_send_mad(send_buf, NULL);
else
ret = -EINVAL;
--
2.12.2