diff mbox series

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

Message ID 20250123214831.401B54E601A@zero.eik.bme.hu (mailing list archive)
State New, archived
Headers show
Series hw/usb/hcd-ehci: Fix debug printf format string | expand

Commit Message

BALATON Zoltan Jan. 23, 2025, 9:48 p.m. UTC
The variable is uint64_t so needs %ld instead of %d.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/usb/hcd-ehci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé Jan. 23, 2025, 10:09 p.m. UTC | #1
Hi Zoltan,

On 23/1/25 22:48, BALATON Zoltan wrote:
> 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")

> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>   hw/usb/hcd-ehci.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
> index 6c4c14c895..23b3e20fdb 100644
> --- a/hw/usb/hcd-ehci.c
> +++ b/hw/usb/hcd-ehci.c
> @@ -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()?

>           }
>   
>           for (i = 0; i < uframes; i++) {
BALATON Zoltan Jan. 24, 2025, 12:46 p.m. UTC | #2
On Thu, 23 Jan 2025, Philippe Mathieu-Daudé wrote:
> Hi Zoltan,
>
> On 23/1/25 22:48, BALATON Zoltan wrote:
>> 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")
>
>> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
>> ---
>>   hw/usb/hcd-ehci.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
>> index 6c4c14c895..23b3e20fdb 100644
>> --- a/hw/usb/hcd-ehci.c
>> +++ b/hw/usb/hcd-ehci.c
>> @@ -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

>>           }
>>             for (i = 0; i < uframes; i++) {
>
>
diff mbox series

Patch

diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 6c4c14c895..23b3e20fdb 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -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++) {