From: Osama Abdelkader <osama.abdelkader@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, peter.maydell@linaro.org,
Osama Abdelkader <osama.abdelkader@gmail.com>
Subject: [PATCH] hw/arm/boot: replace fprintf with error_report
Date: Sat, 23 Aug 2025 17:03:21 +0200 [thread overview]
Message-ID: <20250823150321.135527-1-osama.abdelkader@gmail.com> (raw)
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
next reply other threads:[~2025-08-23 15:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-23 15:03 Osama Abdelkader [this message]
2025-09-01 16:24 ` [PATCH] hw/arm/boot: replace fprintf with error_report 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250823150321.135527-1-osama.abdelkader@gmail.com \
--to=osama.abdelkader@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).