* [PATCH][next] RDMA/siw: replace redundant ternary operator with just rv
@ 2025-05-07 13:18 Colin Ian King
2025-05-07 14:04 ` Bernard Metzler
2025-05-12 10:20 ` Leon Romanovsky
0 siblings, 2 replies; 3+ messages in thread
From: Colin Ian King @ 2025-05-07 13:18 UTC (permalink / raw)
To: Bernard Metzler, Jason Gunthorpe, Leon Romanovsky, linux-rdma
Cc: kernel-janitors, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH][next] RDMA/siw: replace redundant ternary operator with just rv
2025-05-07 13:18 [PATCH][next] RDMA/siw: replace redundant ternary operator with just rv Colin Ian King
@ 2025-05-07 14:04 ` Bernard Metzler
2025-05-12 10:20 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Bernard Metzler @ 2025-05-07 14:04 UTC (permalink / raw)
To: Colin Ian King, Jason Gunthorpe, Leon Romanovsky, linux-rdma
Cc: kernel-janitors, linux-kernel
> -----Original Message-----
> From: Colin Ian King <colin.i.king@gmail.com>
> Sent: Wednesday, May 7, 2025 3:19 PM
> To: Bernard Metzler <BMT@zurich.ibm.com>; Jason Gunthorpe <jgg@ziepe.ca>;
> Leon Romanovsky <leon@kernel.org>; linux-rdma@vger.kernel.org
> Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [EXTERNAL] [PATCH][next] 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.
>
> 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
Thanks Colin, makes sense.
Acked-by: Bernard Metzler <bmt@zurich.ibm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] RDMA/siw: replace redundant ternary operator with just rv
2025-05-07 13:18 [PATCH][next] RDMA/siw: replace redundant ternary operator with just rv Colin Ian King
2025-05-07 14:04 ` Bernard Metzler
@ 2025-05-12 10:20 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2025-05-12 10:20 UTC (permalink / raw)
To: Bernard Metzler, Jason Gunthorpe, linux-rdma, Colin Ian King
Cc: kernel-janitors, linux-kernel
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-12 10:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-07 13:18 [PATCH][next] RDMA/siw: replace redundant ternary operator with just rv Colin Ian King
2025-05-07 14:04 ` Bernard Metzler
2025-05-12 10:20 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®