Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: hch@infradead.org (Christoph Hellwig)
Subject: [PATCH] nvme-loop: kfree(ctrl) on _create() error exit
Date: Thu, 27 Oct 2016 09:00:17 -0700	[thread overview]
Message-ID: <20161027160017.GA15393@infradead.org> (raw)
In-Reply-To: <1477582813.2838.11.camel@linux.intel.com>

On Thu, Oct 27, 2016@08:40:13AM -0700, J Freyensee wrote:
> But doesn't nvme_put_ctrl() just take care of the nvme_ctrl? ?The
> kfree(ctrl) is for nvme_loop_ctrl instance being kzalloc'ed at the
> beginning of the function.

The nvmet_ctrl structure is embedded into the nvme_loop_ctrl structure,
it's not a separate allocation.

> ?I don't think this is any different than
> what is done for the create_ctrl() implementation in host/rdma.c?:
> 
> host/rdma.c
> ===========
> out_uninit_ctrl:
> 	nvme_uninit_ctrl(&ctrl->ctrl);
> 	nvme_put_ctrl(&ctrl->ctrl);
> 	if (ret > 0)
> 		ret = -EIO;
> 	return ERR_PTR(ret);

This is the case after nvme_init_ctrl and we just do the put and then
return.

> out_free_ctrl:
> 	kfree(ctrl); ? <-- this is for nvme_rdma_ctrl alloc
> 	return ERR_PTR(ret);

And this is the case before we did nvme_init_ctrl and we just kfree the
ctrl.

  reply	other threads:[~2016-10-27 16:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26 20:20 [PATCH] nvme-loop: kfree(ctrl) on _create() error exit Jay Freyensee
2016-10-27 12:13 ` Sagi Grimberg
2016-10-27 12:49 ` Christoph Hellwig
2016-10-27 15:40   ` J Freyensee
2016-10-27 16:00     ` Christoph Hellwig [this message]
2016-10-30  6:48       ` 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=20161027160017.GA15393@infradead.org \
    --to=hch@infradead.org \
    /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