From: Leon Romanovsky <leon@kernel.org>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Chiara Meiohas <cmeiohas@nvidia.com>,
linux-rdma@vger.kernel.org, Yishai Hadas <yishaih@nvidia.com>
Subject: Re: [PATCH rdma-next 1/6] RDMA/uverbs: Introduce UCAP (User CAPabilities) API
Date: Tue, 4 Mar 2025 15:44:18 +0200 [thread overview]
Message-ID: <20250304134418.GF1955273@unreal> (raw)
In-Reply-To: <20250304131852.GH133783@nvidia.com>
On Tue, Mar 04, 2025 at 09:18:52AM -0400, Jason Gunthorpe wrote:
> On Wed, Feb 26, 2025 at 04:17:27PM +0200, Leon Romanovsky wrote:
> > +int ib_create_ucap(enum rdma_user_cap type)
> > +{
> > + struct ib_ucap *ucap;
> > + int ret;
> > +
> > + if (type >= RDMA_UCAP_MAX)
> > + return -EINVAL;
> > +
> > + mutex_lock(&ucaps_mutex);
> > + ret = ib_ucaps_init();
> > + if (ret)
> > + goto unlock;
> > +
> > + ucap = ucaps_list[type];
> > + if (ucap) {
> > + ucap->refcount++;
> > + mutex_unlock(&ucaps_mutex);
> > + return 0;
> > + }
> > +
> > + ucap = kzalloc(sizeof(*ucap), GFP_KERNEL);
> > + if (!ucap) {
> > + ret = -ENOMEM;
> > + goto unlock;
> > + }
> > +
> > + device_initialize(&ucap->dev);
> > + ucap->dev.class = &ucaps_class;
> > + ucap->dev.devt = MKDEV(MAJOR(ucaps_base_dev), type);
> > + ucap->dev.release = ucap_dev_release;
> > + dev_set_name(&ucap->dev, ucap_names[type]);
>
> Missing error handling on dev_set_name()
Most of the kernel users don't check dev_set_name(). It can't fail in
reality.
>
> > +#define UCAP_ENABLED(ucaps, type) (!!((ucaps) & (1U << type)))
>
> Missing () around type
>
> Why not use a static inline?
I don't think that static inline gives any benefit here.
Thanks
>
> Jason
next prev parent reply other threads:[~2025-03-04 13:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 14:17 [PATCH rdma-next 0/6] Introduce UCAP API and usage in mlx5 Leon Romanovsky
2025-02-26 14:17 ` [PATCH rdma-next 1/6] RDMA/uverbs: Introduce UCAP (User CAPabilities) API Leon Romanovsky
2025-03-04 13:18 ` Jason Gunthorpe
2025-03-04 13:44 ` Leon Romanovsky [this message]
2025-03-04 14:30 ` Jason Gunthorpe
2025-03-04 14:44 ` Leon Romanovsky
2025-03-05 8:31 ` Kalesh Anakkur Purayil
2025-03-05 9:55 ` Leon Romanovsky
2025-03-05 10:08 ` Kalesh Anakkur Purayil
2025-03-05 11:41 ` Leon Romanovsky
2025-02-26 14:17 ` [PATCH rdma-next 2/6] RDMA/mlx5: Create UCAP char devices for supported device capabilities Leon Romanovsky
2025-02-26 14:17 ` [PATCH rdma-next 3/6] RDMA/uverbs: Add support for UCAPs in context creation Leon Romanovsky
2025-02-26 14:17 ` [PATCH rdma-next 4/6] RDMA/mlx5: Check enabled UCAPs when creating ucontext Leon Romanovsky
2025-02-26 14:17 ` [PATCH rdma-next 5/6] RDMA/mlx5: Expose RDMA TRANSPORT flow table types to userspace Leon Romanovsky
2025-02-26 14:17 ` [PATCH rdma-next 6/6] docs: infiniband: document the UCAP API Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250304134418.GF1955273@unreal \
--to=leon@kernel.org \
--cc=cmeiohas@nvidia.com \
--cc=jgg@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=yishaih@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox