From: Keith Busch Date: Mon, 27 Feb 2017 15:06:43 +0000 (-0500) Subject: Don't print unimplemented sensor X-Git-Tag: v1.2~15 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e9104a88e0fba302a0cb8c327717d332a416be3e;p=users%2Fsagi%2Fnvme-cli.git Don't print unimplemented sensor This is an optional feature, no need to display it if not implemented. A value of 0 indicates it's not used. Signed-off-by: Keith Busch --- diff --git a/nvme-print.c b/nvme-print.c index d4dd7d57..526efd4d 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -806,8 +806,11 @@ void show_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const char printf("Critical Composite Temperature Time : %u\n", le32_to_cpu(smart->critical_comp_time)); for (c=0; c < 8; c++) { __s32 temp = le16_to_cpu(smart->temp_sensor[c]); + + if (temp == 0) + continue; printf("Temperature Sensor %d : %d C\n", c + 1, - temp ? temp - 273 : 0); + temp - 273); } }