]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
nvme: Do not return in the middle of the subcommand
authorMinwoo Im <minwoo.im.dev@gmail.com>
Thu, 23 May 2019 14:02:48 +0000 (23:02 +0900)
committerMinwoo Im <minwoo.im.dev@gmail.com>
Thu, 20 Jun 2019 14:22:56 +0000 (23:22 +0900)
commitced67c08089ac1344aa4d19ccab1380afd6fa694
treeb302005a31b8a14fcdbfd9dccff776f5c3944033
parent0fddb03975c9293787f68bac427a34dc66c78edc
nvme: Do not return in the middle of the subcommand

To make nvme-cli subcommand return a mapped errno value to main(), it
should return the error status in a single place because it would be
great if the return statements and free operations are in an one shot
place.

This patch makes all the subcommands in nvme module return the error
which means internal error which should be in negative and nvme error
status which is in positive at the end of the subcommand.

Most of the changed parts are file descriptors which is returned from
parse_and_open() function.  The "fd" could be in a negative value so
that it needs to be mapped to a uniformed errno value which will be
applied by the next patches.

Cc: Keith Busch <kbusch@kernel.org>
Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
nvme.c