Re: [PATCH] nvme: fix uninitialized-variable warning

From: Christoph Hellwig
Date: Thu Jan 30 2020 - 10:48:29 EST


On Thu, Jan 30, 2020 at 04:36:48PM +0100, Arnd Bergmann wrote:
> > This one is just gross. I think we'll need to find some other fix
> > that doesn't obsfucate the code as much.
>
> Initializing the nvme_result in nvme_features() would do it, as would
> setting it in the error path in __nvme_submit_sync_cmd() -- either
> way the compiler cannot be confused about whether it is initialized
> later on.

Given that this is outside the hot path we can just zero the whole
structure before submitting the I/O.