linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDMA/siw: Use max() instead of doing it manually
@ 2021-12-02 10:07 Jiapeng Chong
  2021-12-02 12:07 ` Bernard Metzler
  2021-12-06 23:52 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Jiapeng Chong @ 2021-12-02 10:07 UTC (permalink / raw)
  To: bmt; +Cc: jgg, linux-rdma, linux-kernel, Jiapeng Chong

Fix following coccicheck warning:

./drivers/infiniband/sw/siw/siw_verbs.c:665:28-29: WARNING opportunity
for max().

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/siw: Use max() instead of doing it manually
  2021-12-02 10:07 [PATCH] RDMA/siw: Use max() instead of doing it manually Jiapeng Chong
@ 2021-12-02 12:07 ` Bernard Metzler
  2021-12-06 23:52 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Bernard Metzler @ 2021-12-02 12:07 UTC (permalink / raw)
  To: Jiapeng Chong; +Cc: jgg, linux-rdma, linux-kernel

-----"Jiapeng Chong" <jiapeng.chong@linux.alibaba.com> wrote: -----

>To: bmt@zurich.ibm.com
>From: "Jiapeng Chong" <jiapeng.chong@linux.alibaba.com>
>Date: 12/02/2021 11:08AM
>Cc: jgg@ziepe.ca, linux-rdma@vger.kernel.org,
>linux-kernel@vger.kernel.org, "Jiapeng Chong"
><jiapeng.chong@linux.alibaba.com>
>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@linux.alibaba.com>
>Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
>---
> 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@zurich.ibm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/siw: Use max() instead of doing it manually
  2021-12-02 10:07 [PATCH] RDMA/siw: Use max() instead of doing it manually Jiapeng Chong
  2021-12-02 12:07 ` Bernard Metzler
@ 2021-12-06 23:52 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2021-12-06 23:52 UTC (permalink / raw)
  To: Jiapeng Chong; +Cc: bmt, linux-rdma, linux-kernel

On Thu, Dec 02, 2021 at 06:07:59PM +0800, Jiapeng Chong wrote:
> Fix following coccicheck warning:
> 
> ./drivers/infiniband/sw/siw/siw_verbs.c:665:28-29: WARNING opportunity
> for max().
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> Reviewed-by: Bernard Metzler <bmt@zurich.ibm.com>
> ---
>  drivers/infiniband/sw/siw/siw_verbs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, thanks

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-06 23:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02 10:07 [PATCH] RDMA/siw: Use max() instead of doing it manually Jiapeng Chong
2021-12-02 12:07 ` Bernard Metzler
2021-12-06 23:52 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).