From: Jeremy Kerr Date: Tue, 12 Jul 2022 06:45:29 +0000 (+0800) Subject: plugins/solidigm: fix return value on format parse failure X-Git-Tag: v2.1.2~3^2~5 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=7844222edd0acda76620a17cbfbc756fce6621f0;p=users%2Fsagi%2Fnvme-cli.git plugins/solidigm: fix return value on format parse failure 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 --- diff --git a/plugins/solidigm/solidigm-garbage-collection.c b/plugins/solidigm/solidigm-garbage-collection.c index c7f12860..415722b5 100644 --- a/plugins/solidigm/solidigm-garbage-collection.c +++ b/plugins/solidigm/solidigm-garbage-collection.c @@ -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; diff --git a/plugins/solidigm/solidigm-smart.c b/plugins/solidigm/solidigm-smart.c index 4b30cab8..77a22104 100644 --- a/plugins/solidigm/solidigm-smart.c +++ b/plugins/solidigm/solidigm-smart.c @@ -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);