]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
plugins/solidigm: fix return value on format parse failure
authorJeremy Kerr <jk@codeconstruct.com.au>
Tue, 12 Jul 2022 06:45:29 +0000 (14:45 +0800)
committerJeremy Kerr <jk@codeconstruct.com.au>
Wed, 3 Aug 2022 07:30:19 +0000 (15:30 +0800)
If validate_output_format() fails, there are a couple of paths in the
solidgm code that will return a (closed) file descriptor, rather than an
error status. This looks to be a couple of copy-and-paste errors.

This change fixes the return value for these failure path, ensuring that
we'll actually have an error return.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
plugins/solidigm/solidigm-garbage-collection.c
plugins/solidigm/solidigm-smart.c

index c7f12860e674991d5672e1cc86d5fd51ae424c49..415722b5f5f0ee5ec1c35e3e5025b653a9670599 100644 (file)
@@ -86,7 +86,7 @@ int solidigm_get_garbage_collection_log(int argc, char **argv, struct command *c
        if (flags == -EINVAL) {
                fprintf(stderr, "Invalid output format '%s'\n", cfg.output_format);
                close(fd);
-               return fd;
+               return flags;
        }
 
        garbage_control_collection_log_t gc_log;
index 4b30cab80c7180f2e4582112bdd2e36b966bdb50..77a22104fbead50795ee96ca48e7537ca3d51fb1 100644 (file)
@@ -228,7 +228,7 @@ int solidigm_get_additional_smart_log(int argc, char **argv, struct command *cmd
        if (flags == -EINVAL) {
                fprintf(stderr, "Invalid output format '%s'\n", cfg.output_format);
                close(fd);
-               return fd;
+               return flags;
        }
 
        err = nvme_get_log_simple(fd, solidigm_vu_smart_log_id, sizeof(smart_log_payload), &smart_log_payload);