Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Keith Busch <kbusch@kernel.org>
Cc: Caleb Sander <csander@purestorage.com>,
	Keith Busch <kbusch@meta.com>,
	linux-nvme@lists.infradead.org, hch@lst.de, sagi@grimberg.me,
	mlombard@redhat.com, hare@suse.de, shinichiro.kawasaki@wdc.com
Subject: Re: [PATCH-RFC 2/5] nvme: tcp: split controller bringup handling
Date: Tue, 4 Jun 2024 06:23:03 +0200	[thread overview]
Message-ID: <20240604042303.GA28748@lst.de> (raw)
In-Reply-To: <Zl5_p7C3UOKnp-St@kbusch-mbp.dhcp.thefacebook.com>

On Mon, Jun 03, 2024 at 08:44:55PM -0600, Keith Busch wrote:
> > > +       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.

Or you could use the ERR_CAST helper, which does exactly that void *
cast, but actually documents why it is done :)


  reply	other threads:[~2024-06-04  4:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-03 23:05 [PATCH-RFC 0/5] nvme: fix initialization memleak Keith Busch
2024-06-03 23:05 ` [PATCH-RFC 1/5] nvme: apple: fix device reference counting Keith Busch
2024-06-03 23:17   ` Keith Busch
2024-06-03 23:05 ` [PATCH-RFC 2/5] nvme: tcp: split controller bringup handling Keith Busch
2024-06-04  0:35   ` Caleb Sander
2024-06-04  2:44     ` Keith Busch
2024-06-04  4:23       ` Christoph Hellwig [this message]
2024-06-04  6:47     ` Hannes Reinecke
2024-06-03 23:05 ` [PATCH-RFC 3/5] nvme: rdma: " Keith Busch
2024-06-03 23:05 ` [PATCH-RFC 4/5] nvme: fc: " Keith Busch
2024-06-03 23:05 ` [PATCH-RFC 5/5] nvme: split device add from initialzation Keith Busch
2024-06-04  4:24 ` [PATCH-RFC 0/5] nvme: fix initialization memleak Christoph Hellwig
2024-06-04 14:51 ` Sagi Grimberg

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=20240604042303.GA28748@lst.de \
    --to=hch@lst.de \
    --cc=csander@purestorage.com \
    --cc=hare@suse.de \
    --cc=kbusch@kernel.org \
    --cc=kbusch@meta.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mlombard@redhat.com \
    --cc=sagi@grimberg.me \
    --cc=shinichiro.kawasaki@wdc.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