[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200130150451.GA25427@infradead.org>
Date: Thu, 30 Jan 2020 07:04:51 -0800
From: Christoph Hellwig <hch@...radead.org>
To: Arnd Bergmann <arnd@...db.de>
Cc: Keith Busch <kbusch@...nel.org>, Jens Axboe <axboe@...com>,
Christoph Hellwig <hch@....de>,
Sagi Grimberg <sagi@...mberg.me>,
Oleksandr Natalenko <oleksandr@...hat.com>,
Bart Van Assche <bvanassche@....org>,
Chaitanya Kulkarni <chaitanya.kulkarni@....com>,
Marta Rybczynska <mrybczyn@...ray.eu>,
linux-kernel@...r.kernel.org, linux-nvme@...ts.infradead.org,
Hannes Reinecke <hare@...e.de>
Subject: Re: [PATCH] nvme: fix uninitialized-variable warning
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@...db.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.
Powered by blists - more mailing lists