Re: [PATCH 09/10] RDMA/bnxt_re: Use ib_respond_udata()

Leon Romanovsky
2026-02-13T10:40:28Z

On Thu, Feb 05, 2026 at 09:45:43PM -0400, Jason Gunthorpe wrote:
> All the calls to ib_copy_to_udata() can use this helper safely.
>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> drivers/infiniband/hw/bnxt_re/ib_verbs.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index 6ea03e1f6c23dd..9d1c31bb994218 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -748,7 +748,7 @@ int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)

<...>

> - rc = ib_copy_to_udata(udata, &resp, sizeof(resp));
> + rc = ib_respond_udata(udata, resp);
> if (rc) {
> ibdev_err(&rdev->ibdev, "Failed to copy QP udata");

<...>

> - rc = ib_copy_to_udata(udata, &resp, sizeof(resp));
> + rc = ib_respond_udata(udata, resp);
> if (rc) {
> ibdev_err(&rdev->ibdev, "SRQ copy to udata failed!");

<...>

> - rc = ib_copy_to_udata(udata, &resp, min(sizeof(resp), udata->outlen));
> + rc = ib_respond_udata(udata, resp);
> if (rc) {
> ibdev_err(&rdev->ibdev, "Failed to copy CQ udata");

<...>

> - rc = ib_copy_to_udata(udata, &resp, min(udata->outlen, sizeof(resp)));
> + rc = ib_respond_udata(udata, resp);
> if (rc) {
> ibdev_err(ibdev, "Failed to copy user context");

Should we move the error message into ib_respond_udata() and remove all
the corresponding prints from the drivers?

Thanks

> --
> 2.43.0
>
>