[PATCH][next] RDMA/siw: replace redundant ternary operator with just rv

Colin Ian King posted 1 patch 7 months, 1 week ago
drivers/infiniband/sw/siw/siw_verbs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH][next] RDMA/siw: replace redundant ternary operator with just rv
Posted by Colin Ian King 7 months, 1 week ago
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.

Signed-off-by: Colin Ian King <colin.i.king@gmail.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 7ce0035c54fa..2b2a7b8e93b0 100644
--- a/drivers/infiniband/sw/siw/siw_verbs.c
+++ b/drivers/infiniband/sw/siw/siw_verbs.c
@@ -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)
-- 
2.49.0
Re: [PATCH][next] RDMA/siw: replace redundant ternary operator with just rv
Posted by Leon Romanovsky 7 months ago
On Wed, 07 May 2025 14:18:34 +0100, Colin Ian King wrote:
> 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,
-- 
Leon Romanovsky <leon@kernel.org>