qemu-arm.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/arm/boot: replace fprintf with error_report
@ 2025-08-23 15:03 Osama Abdelkader
  2025-09-01 16:24 ` Peter Maydell
  0 siblings, 1 reply; 6+ messages in thread
From: Osama Abdelkader @ 2025-08-23 15:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm, peter.maydell, Osama Abdelkader

Replace direct fprintf(stderr, …) with QEMU's error_report() API,
which ensures consistent formatting and integrates with QEMU's
logging infrastructure.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
---
 hw/arm/boot.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index d391cd01bb..17c744762f 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -531,13 +531,13 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
         char *filename;
         filename = qemu_find_file(QEMU_FILE_TYPE_DTB, binfo->dtb_filename);
         if (!filename) {
-            fprintf(stderr, "Couldn't open dtb file %s\n", binfo->dtb_filename);
+            error_report("Couldn't open dtb file %s", binfo->dtb_filename);
             goto fail;
         }
 
         fdt = load_device_tree(filename, &size);
         if (!fdt) {
-            fprintf(stderr, "Couldn't open dtb file %s\n", filename);
+            error_report("Couldn't open dtb file %s", filename);
             g_free(filename);
             goto fail;
         }
@@ -545,7 +545,7 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
     } else {
         fdt = binfo->get_dtb(binfo, &size);
         if (!fdt) {
-            fprintf(stderr, "Board was unable to create a dtb blob\n");
+            error_report("Board was unable to create a dtb blob");
             goto fail;
         }
     }
@@ -564,7 +564,7 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
     scells = qemu_fdt_getprop_cell(fdt, "/", "#size-cells",
                                    NULL, &error_fatal);
     if (acells == 0 || scells == 0) {
-        fprintf(stderr, "dtb file invalid (#address-cells or #size-cells 0)\n");
+        error_report("dtb file invalid (#address-cells or #size-cells 0)");
         goto fail;
     }
 
@@ -572,8 +572,8 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
         /* This is user error so deserves a friendlier error message
          * than the failure of setprop_sized_cells would provide
          */
-        fprintf(stderr, "qemu: dtb file not compatible with "
-                "RAM size > 4GB\n");
+        error_report("qemu: dtb file not compatible with "
+                "RAM size > 4GB");
         goto fail;
     }
 
@@ -611,7 +611,7 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
             rc = fdt_add_memory_node(fdt, acells, mem_base,
                                      scells, mem_len, i);
             if (rc < 0) {
-                fprintf(stderr, "couldn't add /memory@%"PRIx64" node\n",
+                error_report("couldn't add /memory@%"PRIx64" node",
                         mem_base);
                 goto fail;
             }
@@ -622,7 +622,7 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
         rc = fdt_add_memory_node(fdt, acells, binfo->loader_start,
                                  scells, binfo->ram_size, -1);
         if (rc < 0) {
-            fprintf(stderr, "couldn't add /memory@%"PRIx64" node\n",
+            error_report("couldn't add /memory@%"PRIx64" node",
                     binfo->loader_start);
             goto fail;
         }
@@ -637,7 +637,7 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
         rc = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs",
                                      ms->kernel_cmdline);
         if (rc < 0) {
-            fprintf(stderr, "couldn't set /chosen/bootargs\n");
+            error_report("couldn't set /chosen/bootargs");
             goto fail;
         }
     }
@@ -646,7 +646,7 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
         rc = qemu_fdt_setprop_sized_cells(fdt, "/chosen", "linux,initrd-start",
                                           acells, binfo->initrd_start);
         if (rc < 0) {
-            fprintf(stderr, "couldn't set /chosen/linux,initrd-start\n");
+            error_report("couldn't set /chosen/linux,initrd-start");
             goto fail;
         }
 
@@ -655,7 +655,7 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
                                           binfo->initrd_start +
                                           binfo->initrd_size);
         if (rc < 0) {
-            fprintf(stderr, "couldn't set /chosen/linux,initrd-end\n");
+            error_report("couldn't set /chosen/linux,initrd-end");
             goto fail;
         }
     }
-- 
2.43.0



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

* Re: [PATCH] hw/arm/boot: replace fprintf with error_report
  2025-08-23 15:03 [PATCH] hw/arm/boot: replace fprintf with error_report Osama Abdelkader
@ 2025-09-01 16:24 ` Peter Maydell
  2025-09-01 16:59   ` Alex Bennée
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Maydell @ 2025-09-01 16:24 UTC (permalink / raw)
  To: Osama Abdelkader; +Cc: qemu-devel, qemu-arm

On Sat, 23 Aug 2025 at 16:03, Osama Abdelkader
<osama.abdelkader@gmail.com> wrote:
>
> Replace direct fprintf(stderr, …) with QEMU's error_report() API,
> which ensures consistent formatting and integrates with QEMU's
> logging infrastructure.
>
> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
> ---
>  hw/arm/boot.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)



Applied to target-arm.next, thanks.

-- PMM


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

* Re: [PATCH] hw/arm/boot: replace fprintf with error_report
  2025-09-01 16:24 ` Peter Maydell
@ 2025-09-01 16:59   ` Alex Bennée
  2025-09-01 21:58     ` Osama Abdelkader
  2025-09-02  8:37     ` Peter Maydell
  0 siblings, 2 replies; 6+ messages in thread
From: Alex Bennée @ 2025-09-01 16:59 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Osama Abdelkader, qemu-devel, qemu-arm

Peter Maydell <peter.maydell@linaro.org> writes:

> On Sat, 23 Aug 2025 at 16:03, Osama Abdelkader
> <osama.abdelkader@gmail.com> wrote:
>>
>> Replace direct fprintf(stderr, …) with QEMU's error_report() API,
>> which ensures consistent formatting and integrates with QEMU's
>> logging infrastructure.
>>
>> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
>> ---
>>  hw/arm/boot.c | 22 +++++++++++-----------
>>  1 file changed, 11 insertions(+), 11 deletions(-)
>
>
>
> Applied to target-arm.next, thanks.

I didn't see this had been posted but I did a more extensive clean-up
here:

  Message-ID: <20250901125304.1047624-1-alex.bennee@linaro.org>
  Date: Mon,  1 Sep 2025 13:53:00 +0100
  Subject: [PATCH 0/4] arm_load_dtb cleanups
  From: =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>

>
> -- PMM

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


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

* Re: [PATCH] hw/arm/boot: replace fprintf with error_report
  2025-09-01 16:59   ` Alex Bennée
@ 2025-09-01 21:58     ` Osama Abdelkader
  2025-09-02  9:22       ` Alex Bennée
  2025-09-02  8:37     ` Peter Maydell
  1 sibling, 1 reply; 6+ messages in thread
From: Osama Abdelkader @ 2025-09-01 21:58 UTC (permalink / raw)
  To: Alex Bennée; +Cc: peter.maydell, qemu-arm, qemu-devel

On Mon, Sep 01, 2025 at 05:59:03PM +0100, Alex Bennée wrote:
> Peter Maydell <peter.maydell@linaro.org> writes:
> 
> > On Sat, 23 Aug 2025 at 16:03, Osama Abdelkader
> > <osama.abdelkader@gmail.com> wrote:
> >>
> >> Replace direct fprintf(stderr, …) with QEMU's error_report() API,
> >> which ensures consistent formatting and integrates with QEMU's
> >> logging infrastructure.
> >>
> >> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
> >> ---
> >>  hw/arm/boot.c | 22 +++++++++++-----------
> >>  1 file changed, 11 insertions(+), 11 deletions(-)
> >
> >
> >
> > Applied to target-arm.next, thanks.
> 
> I didn't see this had been posted but I did a more extensive clean-up
> here:
> 
>   Message-ID: <20250901125304.1047624-1-alex.bennee@linaro.org>
>   Date: Mon,  1 Sep 2025 13:53:00 +0100
>   Subject: [PATCH 0/4] arm_load_dtb cleanups
>   From: =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>
> 
> >
> > -- PMM
> 
> -- 
> Alex Bennée
> Virtualisation Tech Lead @ Linaro

sorry Alex, I didn't know that your patch set covers that.
I just submitted a simple patch to replace fprintf in raspi4b
Would appreciate your review.

Thank you.

Regards,
Osama


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

* Re: [PATCH] hw/arm/boot: replace fprintf with error_report
  2025-09-01 16:59   ` Alex Bennée
  2025-09-01 21:58     ` Osama Abdelkader
@ 2025-09-02  8:37     ` Peter Maydell
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2025-09-02  8:37 UTC (permalink / raw)
  To: Alex Bennée; +Cc: Osama Abdelkader, qemu-devel, qemu-arm

On Mon, 1 Sept 2025 at 17:59, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> Peter Maydell <peter.maydell@linaro.org> writes:
>
> > On Sat, 23 Aug 2025 at 16:03, Osama Abdelkader
> > <osama.abdelkader@gmail.com> wrote:
> >>
> >> Replace direct fprintf(stderr, …) with QEMU's error_report() API,
> >> which ensures consistent formatting and integrates with QEMU's
> >> logging infrastructure.
> >>
> >> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
> >> ---
> >>  hw/arm/boot.c | 22 +++++++++++-----------
> >>  1 file changed, 11 insertions(+), 11 deletions(-)
> >
> >
> >
> > Applied to target-arm.next, thanks.
>
> I didn't see this had been posted but I did a more extensive clean-up
> here:
>
>   Message-ID: <20250901125304.1047624-1-alex.bennee@linaro.org>
>   Date: Mon,  1 Sep 2025 13:53:00 +0100
>   Subject: [PATCH 0/4] arm_load_dtb cleanups
>   From: =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>

OK, I'll drop this one and take that series instead: it
does look like it does a more comprehensive approach.

-- PMM


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

* Re: [PATCH] hw/arm/boot: replace fprintf with error_report
  2025-09-01 21:58     ` Osama Abdelkader
@ 2025-09-02  9:22       ` Alex Bennée
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Bennée @ 2025-09-02  9:22 UTC (permalink / raw)
  To: Osama Abdelkader; +Cc: peter.maydell, qemu-arm, qemu-devel

Osama Abdelkader <osama.abdelkader@gmail.com> writes:

> On Mon, Sep 01, 2025 at 05:59:03PM +0100, Alex Bennée wrote:
>> Peter Maydell <peter.maydell@linaro.org> writes:
>> 
>> > On Sat, 23 Aug 2025 at 16:03, Osama Abdelkader
>> > <osama.abdelkader@gmail.com> wrote:
>> >>
>> >> Replace direct fprintf(stderr, …) with QEMU's error_report() API,
>> >> which ensures consistent formatting and integrates with QEMU's
>> >> logging infrastructure.
>> >>
>> >> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
>> >> ---
>> >>  hw/arm/boot.c | 22 +++++++++++-----------
>> >>  1 file changed, 11 insertions(+), 11 deletions(-)
>> >
>> >
>> >
>> > Applied to target-arm.next, thanks.
>> 
>> I didn't see this had been posted but I did a more extensive clean-up
>> here:
>> 
>>   Message-ID: <20250901125304.1047624-1-alex.bennee@linaro.org>
>>   Date: Mon,  1 Sep 2025 13:53:00 +0100
>>   Subject: [PATCH 0/4] arm_load_dtb cleanups
>>   From: =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org>
>> 
>> >
>> > -- PMM
>> 
>> -- 
>> Alex Bennée
>> Virtualisation Tech Lead @ Linaro
>
> sorry Alex, I didn't know that your patch set covers that.

No need to apologise - qemu-devel is a firehose of patches so its
inevitable two or more people might touch the same thing at the same
time.

> I just submitted a simple patch to replace fprintf in raspi4b
> Would appreciate your review.

I have left some comments.

>
> Thank you.
>
> Regards,
> Osama

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


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

end of thread, other threads:[~2025-09-02  9:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-23 15:03 [PATCH] hw/arm/boot: replace fprintf with error_report Osama Abdelkader
2025-09-01 16:24 ` Peter Maydell
2025-09-01 16:59   ` Alex Bennée
2025-09-01 21:58     ` Osama Abdelkader
2025-09-02  9:22       ` Alex Bennée
2025-09-02  8:37     ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).