From: Minwoo Im Date: Sun, 5 May 2019 11:58:59 +0000 (+0900) Subject: property: Fit print size for a property X-Git-Tag: v1.9~70^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=207f0359f66f7085b59dace73d4b535bb887f6e5;p=users%2Fsagi%2Fnvme-cli.git property: Fit print size for a property We may or may not be able to see the following output in nvme-loop env. # nvme get-property /dev/nvme0 -o 0x14 property: 0x14 (Controller Configuration), value: 7f7800460001 The register CC is not in 64bit, but the upper bits are showing some values even it's reserved in spec. This patch makes this print size to fit to its own size of register. Signed-off-by: Minwoo Im --- diff --git a/nvme-print.c b/nvme-print.c index 156a62c7..d70db203 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -3296,8 +3296,14 @@ void show_single_property(int offset, uint64_t value64, int human) uint32_t value32; if (!human) { - printf("property: 0x%02x (%s), value: %"PRIx64"\n", offset, - nvme_register_to_string(offset), value64); + if (is_64bit_reg(offset)) + printf("property: 0x%02x (%s), value: %"PRIx64"\n", offset, + nvme_register_to_string(offset), value64); + else + printf("property: 0x%02x (%s), value: %x\n", offset, + nvme_register_to_string(offset), + (uint32_t) value64); + return; }