linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Oleksandr Natalenko <oleksandr@redhat.com>,
	Bart Van Assche <bvanassche@acm.org>,
	Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
	Marta Rybczynska <mrybczyn@kalray.eu>,
	linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org,
	Jens Axboe <axboe@fb.com>, Hannes Reinecke <hare@suse.de>,
	Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>,
	Sagi Grimberg <sagi@grimberg.me>
Subject: Re: [PATCH] nvme: fix uninitialized-variable warning
Date: Thu, 30 Jan 2020 07:04:51 -0800	[thread overview]
Message-ID: <20200130150451.GA25427@infradead.org> (raw)
In-Reply-To: <20200107214215.935781-1-arnd@arndb.de>

On Tue, Jan 07, 2020 at 10:42:08PM +0100, Arnd Bergmann wrote:
> Fixes: mmtom ("init/Kconfig: enable -O3 for all arches")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/nvme/host/core.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 667f18f465be..6f0991e8c5cc 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -825,14 +825,15 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
>  	int ret;
>  
>  	req = nvme_alloc_request(q, cmd, flags, qid);
> -	if (IS_ERR(req))
> -		return PTR_ERR(req);
> +	ret = PTR_ERR_OR_ZERO(req);
> +	if (ret < 0)
> +		return ret;

This one is just gross.  I think we'll need to find some other fix
that doesn't obsfucate the code as much.

>  
>  	req->timeout = timeout ? timeout : ADMIN_TIMEOUT;
>  
>  	if (buffer && bufflen) {
>  		ret = blk_rq_map_kern(q, req, buffer, bufflen, GFP_KERNEL);
> -		if (ret)
> +		if (ret < 0)

OTOH if this shuts up a compiler warning I'd be perfectly fine with it.

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

  reply	other threads:[~2020-01-30 15:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 21:42 [PATCH] nvme: fix uninitialized-variable warning Arnd Bergmann
2020-01-30 15:04 ` Christoph Hellwig [this message]
2020-01-30 15:36   ` Arnd Bergmann
2020-01-30 15:48     ` Christoph Hellwig
2020-02-13 19:51       ` Keith Busch
2020-02-19 15:21         ` Christoph Hellwig
2020-02-19 16:19 [PATCH] nvme: Fix " Keith Busch
2020-02-19 16:22 ` Christoph Hellwig
2020-02-20  7:43 ` 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=20200130150451.GA25427@infradead.org \
    --to=hch@infradead.org \
    --cc=arnd@arndb.de \
    --cc=axboe@fb.com \
    --cc=bvanassche@acm.org \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mrybczyn@kalray.eu \
    --cc=oleksandr@redhat.com \
    --cc=sagi@grimberg.me \
    /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).