Skip to contentSkip to conversation

hw/usb/hcd-ehci: Fix debug printf format string

PATCH Superseded BALATON Zoltan 2 participants 3 messages Jan 23, 2025 – Jan 24, 2025

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/usb/hcd-ehci: Fix debug printf format string

The variable is uint64_t so needs %ld instead of %d.

---
 hw/usb/hcd-ehci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/hcd-ehci.c +1 -1
index 6c4c14c895..23b3e20fdb 100644
@@ -2287,7 +2287,7 @@ static void ehci_work_bh(void *opaque)
             ehci_update_frindex(ehci, skipped_uframes);
             ehci->last_run_ns += UFRAME_TIMER_NS * skipped_uframes;
             uframes -= skipped_uframes;
-            DPRINTF("WARNING - EHCI skipped %d uframes\n", skipped_uframes);
+            DPRINTF("WARNING - EHCI skipped %ld uframes\n", skipped_uframes);
         }
 
         for (i = 0; i < uframes; i++) {
Signature · 1 line
2.30.9
#1 lore raw

Hi Zoltan,

Quoted 2 lines · BALATON Zoltan

The variable is uint64_t so needs %ld instead of %d.

Actually the format is PRIu64.

Fixes 3ae7eb88c47 ("ehci: fix overflow in frame timer code")
Quoted 10 lines
---
  hw/usb/hcd-ehci.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/usb/hcd-ehci.c +0 -0
index 6c4c14c895..23b3e20fdb 100644

hw/usb/hcd-ehci.c static void ehci_work_bh(void *opaque) · line 2290

Quoted 5 lines
hw/usb/hcd-ehci.c +1 -1
@@ -2287,7 +2287,7 @@ static void ehci_work_bh(void *opaque)
              ehci_update_frindex(ehci, skipped_uframes);
              ehci->last_run_ns += UFRAME_TIMER_NS * skipped_uframes;
              uframes -= skipped_uframes;
-            DPRINTF("WARNING - EHCI skipped %d uframes\n", skipped_uframes);
+            DPRINTF("WARNING - EHCI skipped %ld uframes\n", skipped_uframes);

Should we take the opportunity to convert to warn_report()?

Quoted 3 lines
hw/usb/hcd-ehci.c +0 -0
          }
 
          for (i = 0; i < uframes; i++) {
#2 lore raw
Quoted 15 lines · Philippe Mathieu-Daudé

Hi Zoltan,

Quoted 2 lines · BALATON Zoltan

The variable is uint64_t so needs %ld instead of %d.

Actually the format is PRIu64.

Fixes 3ae7eb88c47 ("ehci: fix overflow in frame timer code")
Quoted 5 lines
---
  hw/usb/hcd-ehci.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

hw/usb/hcd-ehci.c static void ehci_work_bh(void *opaque) · line 2292

Quoted 12 lines
hw/usb/hcd-ehci.c +1 -1
index 6c4c14c895..23b3e20fdb 100644
@@ -2287,7 +2287,7 @@ static void ehci_work_bh(void *opaque)
              ehci_update_frindex(ehci, skipped_uframes);
              ehci->last_run_ns += UFRAME_TIMER_NS * skipped_uframes;
              uframes -= skipped_uframes;
-            DPRINTF("WARNING - EHCI skipped %d uframes\n", 
 skipped_uframes);
+            DPRINTF("WARNING - EHCI skipped %ld uframes\n", 
 skipped_uframes);

Should we take the opportunity to convert to warn_report()?

I'd leave that to someone else. Sent a v3 fixing the commit message as well and adding R-b from Peter.

Regards,
BALATON Zoltan

Quoted 4 lines
Quoted 2 lines
hw/usb/hcd-ehci.c +0 -0
          }
            for (i = 0; i < uframes; i++) {