Re: [PATCH 09/29] IB/mlx4: Move an assignment out of a check in forward_trap()

From: Majd Dibbiny
Date: Sun Feb 19 2017 - 12:12:24 EST



> On Feb 18, 2017, at 10:58 PM, SF Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
> From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> Date: Fri, 17 Feb 2017 22:22:53 +0100
>
> 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>
> ---
> 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 9518b7244269..860fec8b9601 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.11.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks,
Reviewed-by: Majd Dibbiny
<majd@xxxxxxxxxxxx>