Linux-NVME Archive on lore.kernel.org
 help / color / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Edmund Nadolski <edmund.nadolski@intel.com>
Cc: kbusch@kernel.org, linux-nvme@lists.infradead.org
Subject: Re: [PATCH v2 1/1] nvme: remove unused return code from nvme_alloc_ns
Date: Tue, 26 Nov 2019 23:51:40 -0800
Message-ID: <20191127075140.GA431@infradead.org> (raw)
In-Reply-To: <20191126222632.2446-2-edmund.nadolski@intel.com>

I think this needs some tweaks..

>  	ns = kzalloc_node(sizeof(*ns), GFP_KERNEL, node);
>  	if (!ns)
> -		return -ENOMEM;
> +		goto out;

kmalloc failures already always leave a trace, so we can just return
here.

>  	ns->queue = blk_mq_init_queue(ctrl->tagset);
>  	if (IS_ERR(ns->queue)) {
> @@ -3525,10 +3525,8 @@ static int nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
>  	if (ret)
>  		goto out_free_queue;
>  
> -	if (id->ncap == 0) {
> -		ret = -EINVAL;
> +	if (id->ncap == 0)
>  		goto out_free_id;
> -	}

ncap == 0 means there is no namespace, this is a quirk dating back
to NVMe 1.0 where the driver has to do a sequential scan.  So we don't
need a warning here either.

So looking at this a bit more I'm not even sure we need warning messages
contrary to my previous advice, as the only obvious error that is not
a memory allocation is the command execution in nvme_identify_ns,
and the lightnvm registration which both already log warnings.

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

      reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 22:26 [PATCH v2 0/1] A few code cleanups Edmund Nadolski
2019-11-26 22:26 ` [PATCH v2 1/1] nvme: remove unused return code from nvme_alloc_ns Edmund Nadolski
2019-11-27  7:51   ` Christoph Hellwig [this message]

Reply instructions:

You may reply publically 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=20191127075140.GA431@infradead.org \
    --to=hch@infradead.org \
    --cc=edmund.nadolski@intel.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.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

Linux-NVME Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nvme/0 linux-nvme/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nvme linux-nvme/ https://lore.kernel.org/linux-nvme \
		linux-nvme@lists.infradead.org
	public-inbox-index linux-nvme

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-nvme


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git