mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lightnvm: remove unused rq parameter of nvme_nvm_rqtocmd() to kill warning
@ 2017-05-07 14:14 Geert Uytterhoeven
  2017-05-08  1:53 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2017-05-07 14:14 UTC (permalink / raw)
  To: Javier González, Matias Bjørling, Keith Busch,
	Jens Axboe, Christoph Hellwig, Sagi Grimberg
  Cc: Arnd Bergmann, linux-nvme, linux-kernel, Geert Uytterhoeven

With gcc 4.1.2:

    drivers/nvme/host/lightnvm.c: In function ‘nvme_nvm_submit_io’:
    drivers/nvme/host/lightnvm.c:498: warning: ‘rq’ is used uninitialized in this function

Indeed, since commit 2e13f33a2464fc3a ("lightnvm: create cmd before
allocating request"), the request is passed to nvme_nvm_rqtocmd() before
it is allocated.

Fortunately, as of commit 91276162de9476b8 ("lightnvm: refactor end_io
functions for sync"), nvme_nvm_rqtocmd () no longer uses the passed
request, so this warning is a false positive.

Drop the unused parameter to clean up the code and kill the warning.

Fixes: 2e13f33a2464fc3a ("lightnvm: create cmd before allocating request")
Fixes: 91276162de9476b8 ("lightnvm: refactor end_io functions for sync")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Perhaps nvme_nvm_rqtocmd() should be renamed, too?
---
 drivers/nvme/host/lightnvm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 8c4adac6fafcc56d..206bfdbc1c982b04 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -464,8 +464,8 @@ static int nvme_nvm_set_bb_tbl(struct nvm_dev *nvmdev, struct ppa_addr *ppas,
 	return ret;
 }
 
-static inline void nvme_nvm_rqtocmd(struct request *rq, struct nvm_rq *rqd,
-				struct nvme_ns *ns, struct nvme_nvm_command *c)
+static inline void nvme_nvm_rqtocmd(struct nvm_rq *rqd, struct nvme_ns *ns,
+				    struct nvme_nvm_command *c)
 {
 	c->ph_rw.opcode = rqd->opcode;
 	c->ph_rw.nsid = cpu_to_le32(ns->ns_id);
@@ -503,7 +503,7 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
 	if (!cmd)
 		return -ENOMEM;
 
-	nvme_nvm_rqtocmd(rq, rqd, ns, cmd);
+	nvme_nvm_rqtocmd(rqd, ns, cmd);
 
 	rq = nvme_alloc_request(q, (struct nvme_command *)cmd, 0, NVME_QID_ANY);
 	if (IS_ERR(rq)) {
-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lightnvm: remove unused rq parameter of nvme_nvm_rqtocmd() to kill warning
  2017-05-07 14:14 [PATCH] lightnvm: remove unused rq parameter of nvme_nvm_rqtocmd() to kill warning Geert Uytterhoeven
@ 2017-05-08  1:53 ` Jens Axboe
  2017-05-08  7:25   ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2017-05-08  1:53 UTC (permalink / raw)
  To: Geert Uytterhoeven, Javier González, Matias Bjørling,
	Keith Busch, Christoph Hellwig, Sagi Grimberg
  Cc: linux-nvme, Arnd Bergmann, linux-kernel

On 05/07/2017 08:14 AM, Geert Uytterhoeven wrote:
> With gcc 4.1.2:

Wow, that's ancient.

>     drivers/nvme/host/lightnvm.c: In function ‘nvme_nvm_submit_io’:
>     drivers/nvme/host/lightnvm.c:498: warning: ‘rq’ is used uninitialized in this function
> 
> Indeed, since commit 2e13f33a2464fc3a ("lightnvm: create cmd before
> allocating request"), the request is passed to nvme_nvm_rqtocmd() before
> it is allocated.
> 
> Fortunately, as of commit 91276162de9476b8 ("lightnvm: refactor end_io
> functions for sync"), nvme_nvm_rqtocmd () no longer uses the passed
> request, so this warning is a false positive.
> 
> Drop the unused parameter to clean up the code and kill the warning.

Thanks, applied.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lightnvm: remove unused rq parameter of nvme_nvm_rqtocmd() to kill warning
  2017-05-08  1:53 ` Jens Axboe
@ 2017-05-08  7:25   ` Geert Uytterhoeven
  2017-05-08  7:51     ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2017-05-08  7:25 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Javier González, Matias Bjørling, Keith Busch,
	Christoph Hellwig, Sagi Grimberg, linux-nvme, Arnd Bergmann,
	linux-kernel

Hi Jens,

On Mon, May 8, 2017 at 3:53 AM, Jens Axboe <axboe@fb.com> wrote:
> On 05/07/2017 08:14 AM, Geert Uytterhoeven wrote:
>> With gcc 4.1.2:
>
> Wow, that's ancient.

But it helps to find things like this, and improve the code ;-)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lightnvm: remove unused rq parameter of nvme_nvm_rqtocmd() to kill warning
  2017-05-08  7:25   ` Geert Uytterhoeven
@ 2017-05-08  7:51     ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2017-05-08  7:51 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Jens Axboe, Javier González, Matias Bjørling,
	Keith Busch, Christoph Hellwig, Sagi Grimberg, linux-nvme,
	linux-kernel

On Mon, May 8, 2017 at 9:25 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> Hi Jens,
>
> On Mon, May 8, 2017 at 3:53 AM, Jens Axboe <axboe@fb.com> wrote:
>> On 05/07/2017 08:14 AM, Geert Uytterhoeven wrote:
>>> With gcc 4.1.2:
>>
>> Wow, that's ancient.
>
> But it helps to find things like this, and improve the code ;-)

For reference, the warning shows up in gcc-4.2 and 4.3 as well, but
not in gcc-4.4 or
higher unless you disable all optimizations (e.g. gcc-7.1 -O0 warns).

      Arnd

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-05-08  7:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-07 14:14 [PATCH] lightnvm: remove unused rq parameter of nvme_nvm_rqtocmd() to kill warning Geert Uytterhoeven
2017-05-08  1:53 ` Jens Axboe
2017-05-08  7:25   ` Geert Uytterhoeven
2017-05-08  7:51     ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®