RDMA/siw: replace redundant ternary operator with just rv
Subsystems (3)
PATCH 1/1 RDMA/siw: replace redundant ternary operator with just rv
The use of the ternary operator on rv is redundant, rv is either the initialized value of 0 or a negative error return code, so it can never be greater than zero, and hence the zero assignment in ternary operator is redundant. Just return rv instead.
--- drivers/infiniband/sw/siw/siw_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/siw/siw_verbs.c +1 -1
@@ -1102,7 +1102,7 @@ int siw_post_receive(struct ib_qp *base_qp, const struct ib_recv_wr *wr,siw_dbg_qp (qp,"error %d\n" , rv); *bad_wr = wr; } -return rv >0 ?0 : rv; +return rv; }int siw_destroy_cq (struct ib_cq *base_cq,struct ib_udata *udata)
Signature · 1 line
2.49.0
Quoted 36 lines
-----Original Message-----
From: Colin Ian King <[email protected]>
Sent: Wednesday, May 7, 2025 3:19 PM
To: Bernard Metzler <[email protected]>; Jason Gunthorpe <[email protected]>; Leon Romanovsky <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: [EXTERNAL] [PATCH][next] RDMA/siw: replace redundant ternary operator with just rvThe use of the ternary operator on rv is redundant, rv is either the initialized value of 0 or a negative error return code, so it can never be greater than zero, and hence the zero assignment in ternary operator is redundant. Just return rv instead.
Signed-off-by Colin Ian King <[email protected]>--- drivers/infiniband/sw/siw/siw_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/sw/siw/siw_verbs.c +1
-1@@ -1102,7 +1102,7 @@ int siw_post_receive(struct ib_qp *base_qp, conststruct ib_recv_wr *wr, siw_dbg_qp(qp, "error %d\n", rv); *bad_wr = wr; } -return rv >0 ?0 : rv; +return rv; }
Quoted 3 lines
int
siw_destroy_cq(struct ib_cq *base_cq, struct ib_udata *udata)
--
2.49.0
Thanks Colin, makes sense.
Leon Romanovsky
AppliedQuoted 8 lines · Colin Ian King
The use of the ternary operator on rv is redundant, rv is either the initialized value of 0 or a negative error return code, so it can never be greater than zero, and hence the zero assignment in ternary operator is redundant. Just return rv instead.
[...]
Applied, thanks!
[1/1] RDMA/siw: replace redundant ternary operator with just rv
https://git.kernel.org/rdma/rdma/c/8536666a52833d
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>