Re: [PATCH] RDMA/siw: Use max() instead of doing it manually

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----"Jiapeng Chong" <jiapeng.chong@xxxxxxxxxxxxxxxxx> wrote: -----

>To: bmt@xxxxxxxxxxxxxx
>From: "Jiapeng Chong" <jiapeng.chong@xxxxxxxxxxxxxxxxx>
>Date: 12/02/2021 11:08AM
>Cc: jgg@xxxxxxxx, linux-rdma@xxxxxxxxxxxxxxx,
>linux-kernel@xxxxxxxxxxxxxxx, "Jiapeng Chong"
><jiapeng.chong@xxxxxxxxxxxxxxxxx>
>Subject: [EXTERNAL] [PATCH] RDMA/siw: Use max() instead of doing it
>manually
>
>Fix following coccicheck warning:
>
>./drivers/infiniband/sw/siw/siw_verbs.c:665:28-29: WARNING
>opportunity
>for max().
>
>Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
>Signed-off-by: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
>---
> drivers/infiniband/sw/siw/siw_verbs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/infiniband/sw/siw/siw_verbs.c
>b/drivers/infiniband/sw/siw/siw_verbs.c
>index d15a1f9..a3dd2cb 100644
>--- a/drivers/infiniband/sw/siw/siw_verbs.c
>+++ b/drivers/infiniband/sw/siw/siw_verbs.c
>@@ -662,7 +662,7 @@ static int siw_copy_inline_sgl(const struct
>ib_send_wr *core_wr,
> 		kbuf += core_sge->length;
> 		core_sge++;
> 	}
>-	sqe->sge[0].length = bytes > 0 ? bytes : 0;
>+	sqe->sge[0].length = max(bytes, 0);
> 	sqe->num_sge = bytes > 0 ? 1 : 0;
> 
> 	return bytes;
>-- 
>1.8.3.1
>
>
Looks good, thanks!

Reviewed-by: Bernard Metzler <bmt@xxxxxxxxxxxxxx>




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux