From af8d5ba7ea8637a303210820f24bf13caf9c292d Mon Sep 17 00:00:00 2001 From: Jeff Lien Date: Thu, 23 Jan 2020 13:09:46 -0600 Subject: [PATCH] Fix status displayed by vs-telemetry-controller-option wdc plugin command. --- plugins/wdc/wdc-nvme.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/wdc/wdc-nvme.c b/plugins/wdc/wdc-nvme.c index 5891828..a8926bd 100644 --- a/plugins/wdc/wdc-nvme.c +++ b/plugins/wdc/wdc-nvme.c @@ -3751,9 +3751,9 @@ static int wdc_vs_telemetry_controller_option(int argc, char **argv, struct comm 4, buf, &result); if (ret == 0) { if (result) - fprintf(stderr, "Controller Option Telemetry Log Page State: Enabled\n"); - else fprintf(stderr, "Controller Option Telemetry Log Page State: Disabled\n"); + else + fprintf(stderr, "Controller Option Telemetry Log Page State: Enabled\n"); } else { fprintf(stderr, "ERROR : WDC: NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret); } @@ -4870,13 +4870,15 @@ static int wdc_clear_reason_id(int fd) /* verify the drive reason id file name and path is valid */ verify_file = open(reason_id_file, O_WRONLY | O_CREAT | O_TRUNC, 0666); if (verify_file < 0) { - fprintf(stderr, "%s: ERROR : WDC: reason id file not valid : %s\n", __func__, strerror(errno)); - return -1; + ret = -1; + goto free; } close(verify_file); /* remove the reason id file */ ret = remove(reason_id_file); + + free: free(reason_id_file); return ret; -- 2.49.0