diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-11-05 18:23:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-11-05 18:23:26 +0000 |
commit | fab3f41b7b3f080c215157a026ee6bc7efbfe968 (patch) | |
tree | f0fafb0805c3eb11eb2a278f9f8058376c8f0f2b /plugins/solidigm/solidigm-latency-tracking.c | |
parent | Adding upstream version 2.1.2. (diff) | |
download | nvme-cli-fab3f41b7b3f080c215157a026ee6bc7efbfe968.tar.xz nvme-cli-fab3f41b7b3f080c215157a026ee6bc7efbfe968.zip |
Adding upstream version 2.2.1.upstream/2.2.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | plugins/solidigm/solidigm-latency-tracking.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/plugins/solidigm/solidigm-latency-tracking.c b/plugins/solidigm/solidigm-latency-tracking.c index 0bfd611..1013ae8 100644 --- a/plugins/solidigm/solidigm-latency-tracking.c +++ b/plugins/solidigm/solidigm-latency-tracking.c @@ -216,7 +216,7 @@ static void latency_tracker_pre_parse(struct latency_tracker *lt) printf("Major Revision: %u\nMinor Revision: %u\n", le16_to_cpu(lt->stats.version_major), le16_to_cpu(lt->stats.version_minor)); if (lt->has_average_latency_field) { - printf("Average Latency: %lu\n", le64_to_cpu(lt->stats.average_latency)); + printf("Average Latency: %" PRIu64 "\n", le64_to_cpu(lt->stats.average_latency)); } print_dash_separator(); printf("%-12s%-12s%-12s%-20s\n", "Bucket", "Start", "End", "Value"); @@ -385,6 +385,7 @@ int solidigm_get_latency_tracking_log(int argc, char **argv, struct command *cmd struct plugin *plugin) { const char *desc = "Get and Parse Solidigm Latency Tracking Statistics log."; + struct nvme_dev *dev; __u32 enabled; int err; @@ -407,43 +408,45 @@ int solidigm_get_latency_tracking_log(int argc, char **argv, struct command *cmd OPT_END() }; - lt.fd = parse_and_open(argc, argv, desc, opts); - if (lt.fd < 0) - return lt.fd; + err = parse_and_open(&dev, argc, argv, desc, opts); + if (err) + return err; + + lt.fd = dev_fd(dev); lt.print_flags = validate_output_format(lt.cfg.output_format); if (lt.print_flags == -EINVAL) { fprintf(stderr, "Invalid output format '%s'\n", lt.cfg.output_format); - close(lt.fd); + dev_close(dev); return EINVAL; } if (lt.cfg.type > 0xf) { fprintf(stderr, "Invalid Log type value '%d'\n", lt.cfg.type); - close(lt.fd); + dev_close(dev); return EINVAL; } if (lt.cfg.type && !(lt.cfg.read || lt.cfg.write)) { fprintf(stderr, "Log type option valid only when retrieving statistics\n"); - close(lt.fd); + dev_close(dev); return EINVAL; } err = latency_tracking_enable(<); if (err){ - close(lt.fd); + dev_close(dev); return err; } err = latency_tracker_get_log(<); if (err){ - close(lt.fd); + dev_close(dev); return err; } if ((lt.cfg.read || lt.cfg.write || lt.cfg.enable || lt.cfg.disable)) { - close(lt.fd); + dev_close(dev); return 0; } @@ -465,6 +468,8 @@ int solidigm_get_latency_tracking_log(int argc, char **argv, struct command *cmd } else { fprintf(stderr, "Could not read feature id 0xE2.\n"); } - close(lt.fd); + /* Redundant close() to make static code analysis happy */ + close(dev->direct.fd); + dev_close(dev); return err; } |