]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
Show negative temperatures in smart log.
authorKeith Busch <keith.busch@intel.com>
Tue, 29 Nov 2016 15:25:27 +0000 (10:25 -0500)
committerKeith Busch <keith.busch@intel.com>
Tue, 29 Nov 2016 15:25:27 +0000 (10:25 -0500)
Issue: https://github.com/linux-nvme/nvme-cli/issues/141
Signed-off-by: Keith Busch <keith.busch@intel.com>
nvme-print.c

index 34c146d3fe6cf4515aacc1b2412b22f5976f1833..a4b01880146312610c5457db4de93cf478d6c379 100644 (file)
@@ -773,12 +773,12 @@ void show_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const char
 {
        /* convert temperature from Kelvin to Celsius */
        int c;
-       unsigned int temperature = ((smart->temperature[1] << 8) |
+       int temperature = ((smart->temperature[1] << 8) |
                smart->temperature[0]) - 273;
 
        printf("Smart Log for NVME device:%s namespace-id:%x\n", devname, nsid);
        printf("critical_warning                    : %#x\n", smart->critical_warning);
-       printf("temperature                         : %u C\n", temperature);
+       printf("temperature                         : %d C\n", temperature);
        printf("available_spare                     : %u%%\n", smart->avail_spare);
        printf("available_spare_threshold           : %u%%\n", smart->spare_thresh);
        printf("percentage_used                     : %u%%\n", smart->percent_used);