aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiapeng Chong <[email protected]>2021-12-02 18:07:59 +0800
committerJason Gunthorpe <[email protected]>2021-12-06 19:49:19 -0400
commit76937fa552008405d7dd43143545794542623108 (patch)
tree252ff7cb77dafd69112878fab0c2fa005b704556
parent81ff48ddda0b7e1d4d1251d2a9c8e4059cd9456f (diff)
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(). Link: https://lore.kernel.org/r/1638439679-114250-1-git-send-email-jiapeng.chong@linux.alibaba.com Reported-by: Abaci Robot <[email protected]> Signed-off-by: Jiapeng Chong <[email protected]> Reviewed-by: Bernard Metzler <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
-rw-r--r--drivers/infiniband/sw/siw/siw_verbs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c
index d15a1f9c59f0..a3dd2cb6d5c9 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;