]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
Fixup compiler warnings
authorHannes Reinecke <hare@suse.de>
Wed, 6 Oct 2021 15:12:07 +0000 (17:12 +0200)
committerHannes Reinecke <hare@suse.de>
Wed, 6 Oct 2021 15:12:07 +0000 (17:12 +0200)
Compiling with additional compiler options generates some warnings;
fix them.

Signed-off-by: Hannes Reinecke <hare@suse.de>
plugins/dera/dera-nvme.c
plugins/intel/intel-nvme.c
plugins/wdc/wdc-nvme.c
plugins/zns/zns.c

index 976e084bc1cc92b4a9a909c6367093a219326da9..f36fc674a30cb9bebb1a9c3cdfcca19f55bfae68 100644 (file)
@@ -186,7 +186,7 @@ static int get_status(int argc, char **argv, struct command *cmd, struct plugin
        printf("fw_loader_version                   : %.*s\n", 8, log.fw_loader_version);
        printf("uefi_driver_version                 : %.*s\n", 8, log.uefi_driver_version);
 
-       if (log.pcie_volt_status >= 0 && log.pcie_volt_status <= sizeof(volt_status) / sizeof(const char *)){
+       if (log.pcie_volt_status <= sizeof(volt_status) / sizeof(const char *)){
                printf("pcie_volt_status                    : %s\n", volt_status[log.pcie_volt_status]);
        }
        else{
index 557c71d76c67f637382e1fdc34fa886360596901..884fc076497701e95dfc7ffee0f4e01920f4ff4a 100644 (file)
@@ -522,7 +522,7 @@ enum FormatUnit {
 #define US_IN_S 1000000
 #define US_IN_MS 1000
 
-static const enum FormatUnit get_seconds_magnitude(__u32 microseconds)
+static enum FormatUnit get_seconds_magnitude(__u32 microseconds)
 {
        if (microseconds > US_IN_S)
                return S;
@@ -532,7 +532,7 @@ static const enum FormatUnit get_seconds_magnitude(__u32 microseconds)
                return US;
 }
 
-static const float convert_seconds(__u32 microseconds)
+static float convert_seconds(__u32 microseconds)
 {
        float divisor = 1.0;
 
index 6dc484c54ec52082e3fc7d3de0763ed0dc653421..2716d4ceda4fe52d67f66476a6195a257ad8b8e0 100644 (file)
@@ -5406,7 +5406,7 @@ static int wdc_drive_status(int argc, char **argv, struct command *command,
                fprintf(stderr, "ERROR : WDC : Get Format Corrupt Reason Failed\n");
 
        printf("  Drive Status :- \n");
-       if (le32_to_cpu(eol_status) >= 0) {
+       if ((int)le32_to_cpu(eol_status) >= 0) {
                printf("  Percent Used:                         %"PRIu32"%%\n",
                                le32_to_cpu(eol_status));
        }
index 2091f07be5be9f82b18518409b5748a164ce7185..df9df3fe10461e1dde511b443df09e8fa37a1dcb 100644 (file)
@@ -375,15 +375,17 @@ static int zone_mgmt_send(int argc, char **argv, struct command *cmd, struct plu
 
        if (cfg.zsa == NVME_ZNS_ZSA_SET_DESC_EXT) {
                if(!cfg.data_len) {
-                       cfg.data_len = get_zdes_bytes(fd, cfg.namespace_id);
-                       if (!cfg.data_len || cfg.data_len < 0) {
+                       int data_len = get_zdes_bytes(fd, cfg.namespace_id);
+
+                       if (data_len == 0) {
                                fprintf(stderr, 
                                        "Zone Descriptor Extensions are not supported\n");
                                goto close_fd;
-                       } else if (cfg.data_len < 0) {
-                               err = cfg.data_len;
+                       } else if (data_len < 0) {
+                               err = data_len;
                                goto close_fd;
                        }
+                       cfg.data_len = data_len;
                }
                if (posix_memalign(&buf, getpagesize(), cfg.data_len)) {
                        fprintf(stderr, "can not allocate feature payload\n");
@@ -478,7 +480,7 @@ static int set_zone_desc(int argc, char **argv, struct command *cmd, struct plug
 
        int fd, ffd = STDIN_FILENO, err;
        void *buf = NULL;
-       __u32 data_len;
+       int data_len;
 
        struct config {
                __u64   zslba;