From: Martin George Date: Mon, 21 Feb 2022 05:09:14 +0000 (+0530) Subject: nvme: get_ns_id command fails on nvme device X-Git-Tag: v2.0-rc4~5^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=57591db7ede350af6fd2478d531b616a01ccccd6;p=users%2Fsagi%2Fnvme-cli.git nvme: get_ns_id command fails on nvme device The get-ns-id command currently prints the perror status for a given nvme device rather than its nsid. Fix this by properly checking the return status of the nvme_get_nsid() function. Signed-off-by: Martin George --- diff --git a/nvme.c b/nvme.c index cf04a9ae..5e9e5cda 100644 --- a/nvme.c +++ b/nvme.c @@ -3256,7 +3256,7 @@ static int get_ns_id(int argc, char **argv, struct command *cmd, struct plugin * goto ret; err = nvme_get_nsid(fd, &nsid); - if (err <= 0) { + if (err < 0) { fprintf(stderr, "get namespace ID: %s\n", nvme_strerror(errno)); err = errno; goto close_fd;