From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Subject: Re: [PATCH 1/4] hw/loongarch/boot: Remove unnecessary cast to target_ulong
Date: Thu, 9 Oct 2025 14:46:17 -0700 [thread overview]
Message-ID: <dbd10ec2-fb73-4206-8a09-3840e12f93b3@linaro.org> (raw)
In-Reply-To: <20251009201947.34643-2-philmd@linaro.org>
On 10/9/25 13:19, Philippe Mathieu-Daudé wrote:
> Reduce initrd_size scope. It is already of signed type (ssize_t),
> no need to cast to unsigned for the comparison.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/loongarch/boot.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/hw/loongarch/boot.c b/hw/loongarch/boot.c
> index a516415822d..3dd48cb8aab 100644
> --- a/hw/loongarch/boot.c
> +++ b/hw/loongarch/boot.c
> @@ -306,7 +306,7 @@ static ram_addr_t alloc_initrd_memory(struct loongarch_boot_info *info,
> static int64_t load_kernel_info(struct loongarch_boot_info *info)
> {
> uint64_t kernel_entry, kernel_low, kernel_high, initrd_offset = 0;
> - ssize_t kernel_size, initrd_size;
> + ssize_t kernel_size;
>
> kernel_size = load_elf(info->kernel_filename, NULL,
> cpu_loongarch_virt_to_phys, NULL,
> @@ -328,7 +328,8 @@ static int64_t load_kernel_info(struct loongarch_boot_info *info)
> }
>
> if (info->initrd_filename) {
> - initrd_size = get_image_size(info->initrd_filename);
> + ssize_t initrd_size = get_image_size(info->initrd_filename);
> +
> if (initrd_size > 0) {
> initrd_offset = ROUND_UP(kernel_high + 4 * kernel_size, 64 * KiB);
> initrd_offset = alloc_initrd_memory(info, initrd_offset,
> @@ -337,7 +338,7 @@ static int64_t load_kernel_info(struct loongarch_boot_info *info)
> initrd_offset, initrd_size);
> }
>
> - if (initrd_size == (target_ulong)-1) {
> + if (initrd_size == -1) {
> error_report("could not load initial ram disk '%s'",
> info->initrd_filename);
> exit(1);
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
next prev parent reply other threads:[~2025-10-09 21:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-09 20:19 [PATCH 0/4] target/loongarch: Remove some unnecessary target_ulong uses Philippe Mathieu-Daudé
2025-10-09 20:19 ` [PATCH 1/4] hw/loongarch/boot: Remove unnecessary cast to target_ulong Philippe Mathieu-Daudé
2025-10-09 21:46 ` Richard Henderson [this message]
2025-10-09 20:19 ` [PATCH 2/4] target/loongarch: Remove target_ulong use in gen_goto_tb() Philippe Mathieu-Daudé
2025-10-09 21:46 ` Richard Henderson
2025-10-09 20:19 ` [PATCH 3/4] target/loongarch: Remove target_ulong use in gdb_write_register handler Philippe Mathieu-Daudé
2025-10-09 21:47 ` Richard Henderson
2025-10-09 20:19 ` [PATCH 4/4] target/loongarch: Do not use target_ulong type for LDDIR level Philippe Mathieu-Daudé
2025-10-09 21:50 ` Richard Henderson
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=dbd10ec2-fb73-4206-8a09-3840e12f93b3@linaro.org \
--to=richard.henderson@linaro.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).