* [PATCH 0/3] Convert to use ERR_CAST()
@ 2025-04-01 13:07 shao.mingyin
2025-04-01 13:08 ` [PATCH 1/3] RDMA/core: " shao.mingyin
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: shao.mingyin @ 2025-04-01 13:07 UTC (permalink / raw)
To: jgg
Cc: leon, li.haoran7, linux-rdma, linux-kernel, viro, brauner,
agoldberger, cmeiohas, msanalla, dan.carpenter, mrgolin, phaddad,
ynachum, mgurtovoy, yang.yang29, xu.xin16, ye.xingchen
From: Li Haoran <li.haoran7@zte.com.cn>
As opposed to open-code, using the ERR_CAST macro clearly indicates that
this is a pointer to an error value and a type conversion was performed.
Li Haoran (3):
RDMA/core: Convert to use ERR_CAST()
RDMA/uverbs: Convert to use ERR_CAST()
RDMA/core: Convert to use ERR_CAST()
drivers/infiniband/core/mad_rmpp.c | 2 +-
drivers/infiniband/core/uverbs_cmd.c | 2 +-
drivers/infiniband/core/verbs.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] RDMA/core: Convert to use ERR_CAST()
2025-04-01 13:07 [PATCH 0/3] Convert to use ERR_CAST() shao.mingyin
@ 2025-04-01 13:08 ` shao.mingyin
2025-04-01 13:09 ` [PATCH 2/3] RDMA/uverbs: " shao.mingyin
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: shao.mingyin @ 2025-04-01 13:08 UTC (permalink / raw)
To: jgg
Cc: leon, li.haoran7, linux-rdma, linux-kernel, viro, brauner,
agoldberger, cmeiohas, msanalla, dan.carpenter, mrgolin, phaddad,
ynachum, mgurtovoy, yang.yang29, xu.xin16, ye.xingchen
From: Li Haoran <li.haoran7@zte.com.cn>
As opposed to open-code, using the ERR_CAST macro clearly indicates that
this is a pointer to an error value and a type conversion was performed.
Signed-off-by: Li Haoran <li.haoran7@zte.com.cn>
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
drivers/infiniband/core/mad_rmpp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/mad_rmpp.c b/drivers/infiniband/core/mad_rmpp.c
index 8af0619a39cd..b4b10e8a6495 100644
--- a/drivers/infiniband/core/mad_rmpp.c
+++ b/drivers/infiniband/core/mad_rmpp.c
@@ -158,7 +158,7 @@ static struct ib_mad_send_buf *alloc_response_msg(struct ib_mad_agent *agent,
ah = ib_create_ah_from_wc(agent->qp->pd, recv_wc->wc,
recv_wc->recv_buf.grh, agent->port_num);
if (IS_ERR(ah))
- return (void *) ah;
+ return ERR_CAST(ah);
hdr_len = ib_get_mad_data_offset(recv_wc->recv_buf.mad->mad_hdr.mgmt_class);
msg = ib_create_send_mad(agent, recv_wc->wc->src_qp,
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] RDMA/uverbs: Convert to use ERR_CAST()
2025-04-01 13:07 [PATCH 0/3] Convert to use ERR_CAST() shao.mingyin
2025-04-01 13:08 ` [PATCH 1/3] RDMA/core: " shao.mingyin
@ 2025-04-01 13:09 ` shao.mingyin
2025-04-01 13:10 ` [PATCH 3/3] RDMA/core: " shao.mingyin
2025-04-07 18:12 ` [PATCH 0/3] " Jason Gunthorpe
3 siblings, 0 replies; 5+ messages in thread
From: shao.mingyin @ 2025-04-01 13:09 UTC (permalink / raw)
To: jgg
Cc: leon, li.haoran7, linux-rdma, linux-kernel, viro, brauner,
agoldberger, cmeiohas, msanalla, dan.carpenter, mrgolin, phaddad,
ynachum, mgurtovoy, yang.yang29, xu.xin16, ye.xingchen
From: Li Haoran <li.haoran7@zte.com.cn>
As opposed to open-code, using the ERR_CAST macro clearly indicates that
this is a pointer to an error value and a type conversion was performed.
Signed-off-by: Li Haoran <li.haoran7@zte.com.cn>
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
drivers/infiniband/core/uverbs_cmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 3c3bb670c805..bc9fe3ceca4d 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -193,7 +193,7 @@ _ib_uverbs_lookup_comp_file(s32 fd, struct uverbs_attr_bundle *attrs)
fd, attrs);
if (IS_ERR(uobj))
- return (void *)uobj;
+ return ERR_CAST(uobj);
uverbs_uobject_get(uobj);
uobj_put_read(uobj);
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] RDMA/core: Convert to use ERR_CAST()
2025-04-01 13:07 [PATCH 0/3] Convert to use ERR_CAST() shao.mingyin
2025-04-01 13:08 ` [PATCH 1/3] RDMA/core: " shao.mingyin
2025-04-01 13:09 ` [PATCH 2/3] RDMA/uverbs: " shao.mingyin
@ 2025-04-01 13:10 ` shao.mingyin
2025-04-07 18:12 ` [PATCH 0/3] " Jason Gunthorpe
3 siblings, 0 replies; 5+ messages in thread
From: shao.mingyin @ 2025-04-01 13:10 UTC (permalink / raw)
To: jgg
Cc: leon, li.haoran7, linux-rdma, linux-kernel, viro, brauner,
agoldberger, cmeiohas, msanalla, dan.carpenter, mrgolin, phaddad,
ynachum, mgurtovoy, yang.yang29, xu.xin16, ye.xingchen
From: Li Haoran <li.haoran7@zte.com.cn>
As opposed to open-code, using the ERR_CAST macro clearly indicates that
this is a pointer to an error value and a type conversion was performed.
Signed-off-by: Li Haoran <li.haoran7@zte.com.cn>
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
drivers/infiniband/core/verbs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index c5e78bbefbd0..75fde0fe9989 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -572,7 +572,7 @@ struct ib_ah *rdma_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr,
GFP_KERNEL : GFP_ATOMIC);
if (IS_ERR(slave)) {
rdma_unfill_sgid_attr(ah_attr, old_sgid_attr);
- return (void *)slave;
+ return ERR_CAST(slave);
}
ah = _rdma_create_ah(pd, ah_attr, flags, NULL, slave);
rdma_lag_put_ah_roce_slave(slave);
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] Convert to use ERR_CAST()
2025-04-01 13:07 [PATCH 0/3] Convert to use ERR_CAST() shao.mingyin
` (2 preceding siblings ...)
2025-04-01 13:10 ` [PATCH 3/3] RDMA/core: " shao.mingyin
@ 2025-04-07 18:12 ` Jason Gunthorpe
3 siblings, 0 replies; 5+ messages in thread
From: Jason Gunthorpe @ 2025-04-07 18:12 UTC (permalink / raw)
To: shao.mingyin
Cc: leon, li.haoran7, linux-rdma, linux-kernel, viro, brauner,
agoldberger, cmeiohas, msanalla, dan.carpenter, mrgolin, phaddad,
ynachum, mgurtovoy, yang.yang29, xu.xin16, ye.xingchen
On Tue, Apr 01, 2025 at 09:07:30PM +0800, shao.mingyin@zte.com.cn wrote:
> From: Li Haoran <li.haoran7@zte.com.cn>
>
> As opposed to open-code, using the ERR_CAST macro clearly indicates that
> this is a pointer to an error value and a type conversion was performed.
>
> Li Haoran (3):
> RDMA/core: Convert to use ERR_CAST()
> RDMA/uverbs: Convert to use ERR_CAST()
> RDMA/core: Convert to use ERR_CAST()
>
> drivers/infiniband/core/mad_rmpp.c | 2 +-
> drivers/infiniband/core/uverbs_cmd.c | 2 +-
> drivers/infiniband/core/verbs.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
Applied to for-next, thanks
Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-07 18:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-01 13:07 [PATCH 0/3] Convert to use ERR_CAST() shao.mingyin
2025-04-01 13:08 ` [PATCH 1/3] RDMA/core: " shao.mingyin
2025-04-01 13:09 ` [PATCH 2/3] RDMA/uverbs: " shao.mingyin
2025-04-01 13:10 ` [PATCH 3/3] RDMA/core: " shao.mingyin
2025-04-07 18:12 ` [PATCH 0/3] " 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).