linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: willy@linux.intel.com (Matthew Wilcox)
Subject: [PATCH v2] NVMe: fix error return code in nvme_submit_bio_queue()
Date: Fri, 17 May 2013 09:42:01 -0400	[thread overview]
Message-ID: <20130517134201.GU6057@linux.intel.com> (raw)
In-Reply-To: <CAPgLHd8a0UuopsM53j5NsZz1UaqZoRK0_aK2m=XqC2iv-i9rAw@mail.gmail.com>

On Mon, May 13, 2013@10:29:04PM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei at trendmicro.com.cn>
> 
> Fix to return -ENOMEM in the nvem iod alloc error handling case instead
> of 0(possible overwrite to 0 by above nvme_submit_flush_data()), as done
> elsewhere in this function.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei at trendmicro.com.cn>

Applied, slightly modified to fit the style a little better.

> v1 -> v2: send to mail list from MAINTAINERS
> ---
>  drivers/block/nvme-core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
> index 8efdfaa..750c337 100644
> --- a/drivers/block/nvme-core.c
> +++ b/drivers/block/nvme-core.c
> @@ -629,7 +629,7 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
>  	struct nvme_command *cmnd;
>  	struct nvme_iod *iod;
>  	enum dma_data_direction dma_dir;
> -	int cmdid, length, result = -ENOMEM;
> +	int cmdid, length, result;
>  	u16 control;
>  	u32 dsmgmt;
>  	int psegs = bio_phys_segments(ns->queue, bio);
> @@ -641,8 +641,10 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
>  	}
>  
>  	iod = nvme_alloc_iod(psegs, bio->bi_size, GFP_ATOMIC);
> -	if (!iod)
> +	if (!iod) {
> +		result = -ENOMEM;
>  		goto nomem;
> +	}
>  	iod->private = bio;
>  
>  	result = -EBUSY;

      reply	other threads:[~2013-05-17 13:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13 14:29 [PATCH v2] NVMe: fix error return code in nvme_submit_bio_queue() Wei Yongjun
2013-05-17 13:42 ` Matthew Wilcox [this message]

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=20130517134201.GU6057@linux.intel.com \
    --to=willy@linux.intel.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;
as well as URLs for NNTP newsgroup(s).