[PATCH-RFC 2/5] nvme: tcp: split controller bringup handling

Keith Busch kbusch at kernel.org
Mon Jun 3 19:44:55 PDT 2024


On Mon, Jun 03, 2024 at 05:35:13PM -0700, Caleb Sander wrote:
> On Mon, Jun 3, 2024 at 4:08 PM Keith Busch <kbusch at meta.com> wrote:
> > +static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev,
> > +               struct nvmf_ctrl_options *opts)
> > +{
> > +       struct nvme_tcp_ctrl *ctrl;
> > +       int ret;
> > +
> > +       ctrl = nvme_tcp_alloc_ctrl(dev, opts);
> > +       if (IS_ERR(ctrl))
> > +               return (struct nvme_ctrl *)ctrl;
> 
> This cast doesn't look right, as struct nvme_tcp_ctrl doesn't start
> with a struct nvme_ctrl field. Looks like this should be &ctrl->ctrl
> to match the current implementation of nvme_tcp_create_ctrl()?

We can't take an offset here because the "ctrl" is an ERR_PTR, and we
want to preserve that for this function's return value. I could cast to
a "void *" instead to suppress the compiler complaints if that helps get
the intention across.



More information about the Linux-nvme mailing list