nvme-pci: set the errno on ctrl state change error
authorChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Sat, 8 Jun 2019 20:01:02 +0000 (13:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:14:09 +0000 (09:14 +0200)
commit762bba1b7ee755977d3f8d3d1140a54eb5d8bd07
tree3c11d7fea59b312e99945f4ca7edcf8615aafd8f
parentc876a66553d7075aa893cc3720bab9e7ed06bca1
nvme-pci: set the errno on ctrl state change error

[ Upstream commit e71afda49335620e3d9adf56015676db33a3bd86 ]

This patch removes the confusing assignment of the variable result at
the time of declaration and sets the value in error cases next to the
places where the actual error is happening.

Here we also set the result value to -ENODEV when we fail at the final
ctrl state transition in nvme_reset_work(). Without this assignment
result will hold 0 from nvme_setup_io_queue() and on failure 0 will be
passed to he nvme_remove_dead_ctrl() from final state transition.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/pci.c