All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-cli: fix compilation error
@ 2018-06-11  2:03 Chaitanya Kulkarni
  2018-06-11 14:57 ` Keith Busch
  0 siblings, 1 reply; 3+ messages in thread
From: Chaitanya Kulkarni @ 2018-06-11  2:03 UTC (permalink / raw)


[root at q nvme-cli]# git log -1
commit 80f2d776e41128fbf7676d665dd6c9ee5aeeffcd (HEAD -> master, origin/master, origin/HEAD)
Merge: 2dda3f7 6d4b4b3
Author: Keith Busch <keith.busch at intel.com>
Date:   Fri Jun 8 16:19:27 2018 -0600

    Merge pull request #365 from maximveligan/master

    Wrote man page for telemetry

[root at q nvme-cli]# make
NVME_VERSION = 1.5.182.g80f2
cc -D_GNU_SOURCE -D__CHECK_ENDIAN__ -O2 -g -Wall -Werror -std=gnu99 -DLIBUUID -DNVME_VERSION='"1.5.182.g80f2"' -c nvme-print.c
nvme-print.c: In function ?show_self_test_log?:
nvme-print.c:1282:4: error: format ?%lx? expects argument of type ?long unsigned int?, but argument 2 has type ?__le64? [-Werror=format=]
    le64_to_cpu(self_test->result[i].power_on_hours));
    ^
cc1: all warnings being treated as errors
make: *** [nvme-print.o] Error 1
[root at qemu nvme-cli]#

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 nvme-print.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nvme-print.c b/nvme-print.c
index 3f679d2..0d91a82 100644
--- a/nvme-print.c
+++ b/nvme-print.c
@@ -1278,7 +1278,7 @@ void show_self_test_log(struct nvme_self_test_log *self_test, const char *devnam
 
 		temp = self_test->result[i].valid_diagnostic_info;
 		printf("  Valid Diagnostic Information : %#x\n", temp);
-		printf("  Power on hours (POH)         : %#"PRIx64"\n",
+		printf("  Power on hours (POH)         : %#llx\n",
 			le64_to_cpu(self_test->result[i].power_on_hours));
 
 		if (temp & NVME_SELF_TEST_VALID_NSID)
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] nvme-cli: fix compilation error
  2018-06-11  2:03 [PATCH] nvme-cli: fix compilation error Chaitanya Kulkarni
@ 2018-06-11 14:57 ` Keith Busch
  2018-06-11 15:07   ` Chaitanya Kulkarni
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Busch @ 2018-06-11 14:57 UTC (permalink / raw)


On Sun, Jun 10, 2018@10:03:41PM -0400, Chaitanya Kulkarni wrote:
> [root at q nvme-cli]# make
> NVME_VERSION = 1.5.182.g80f2
> cc -D_GNU_SOURCE -D__CHECK_ENDIAN__ -O2 -g -Wall -Werror -std=gnu99 -DLIBUUID -DNVME_VERSION='"1.5.182.g80f2"' -c nvme-print.c
> nvme-print.c: In function ?show_self_test_log?:
> nvme-print.c:1282:4: error: format ?%lx? expects argument of type ?long unsigned int?, but argument 2 has type ?__le64? [-Werror=format=]
>     le64_to_cpu(self_test->result[i].power_on_hours));
>     ^

The way we've been fixing this is to cast the return of le64_to_cpu to
uint64_t. That should work for 64 and 32 bit.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] nvme-cli: fix compilation error
  2018-06-11 14:57 ` Keith Busch
@ 2018-06-11 15:07   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 3+ messages in thread
From: Chaitanya Kulkarni @ 2018-06-11 15:07 UTC (permalink / raw)


Okay, let me resend. 

> On Jun 11, 2018,@7:54 AM, Keith Busch <keith.busch@linux.intel.com> wrote:
> 
>> On Sun, Jun 10, 2018@10:03:41PM -0400, Chaitanya Kulkarni wrote:
>> [root at q nvme-cli]# make
>> NVME_VERSION = 1.5.182.g80f2
>> cc -D_GNU_SOURCE -D__CHECK_ENDIAN__ -O2 -g -Wall -Werror -std=gnu99 -DLIBUUID -DNVME_VERSION='"1.5.182.g80f2"' -c nvme-print.c
>> nvme-print.c: In function ?show_self_test_log?:
>> nvme-print.c:1282:4: error: format ?%lx? expects argument of type ?long unsigned int?, but argument 2 has type ?__le64? [-Werror=format=]
>>    le64_to_cpu(self_test->result[i].power_on_hours));
>>    ^
> 
> The way we've been fixing this is to cast the return of le64_to_cpu to
> uint64_t. That should work for 64 and 32 bit.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-11 15:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-11  2:03 [PATCH] nvme-cli: fix compilation error Chaitanya Kulkarni
2018-06-11 14:57 ` Keith Busch
2018-06-11 15:07   ` Chaitanya Kulkarni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.