aboutsummaryrefslogtreecommitdiff
path: root/hw/mips
diff options
context:
space:
mode:
authorJiaxun Yang <jiaxun.yang@flygoat.com>2021-11-30 21:17:29 +0000
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2021-12-06 11:57:36 +0100
commitd77c462bf25001cc2ae03824a547ed761cd0c5bc (patch)
treed79d347576c386b8967e12e9a4e29758e80576e8 /hw/mips
parent24ade8c5decd092bde5e863bc542db45d924ae12 (diff)
downloadqemu-d77c462bf25001cc2ae03824a547ed761cd0c5bc.zip
qemu-d77c462bf25001cc2ae03824a547ed761cd0c5bc.tar.gz
qemu-d77c462bf25001cc2ae03824a547ed761cd0c5bc.tar.bz2
hw/mips/boston: Fix load_elf() error detection
load_elf() gives negative return in case of error, not zero. Fixes: 10e3f30ff73 ("hw/mips/boston: Allow loading elf kernel and dtb") Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20211130211729.7116-3-jiaxun.yang@flygoat.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'hw/mips')
-rw-r--r--hw/mips/boston.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/mips/boston.c b/hw/mips/boston.c
index 0e3cca5..59ca08b 100644
--- a/hw/mips/boston.c
+++ b/hw/mips/boston.c
@@ -777,14 +777,15 @@ static void boston_mach_init(MachineState *machine)
exit(1);
}
} else if (machine->kernel_filename) {
- uint64_t kernel_entry, kernel_high, kernel_size;
+ uint64_t kernel_entry, kernel_high;
+ ssize_t kernel_size;
kernel_size = load_elf(machine->kernel_filename, NULL,
cpu_mips_kseg0_to_phys, NULL,
&kernel_entry, NULL, &kernel_high,
NULL, 0, EM_MIPS, 1, 0);
- if (kernel_size) {
+ if (kernel_size > 0) {
int dt_size;
g_autofree const void *dtb_file_data, *dtb_load_data;
hwaddr dtb_paddr = QEMU_ALIGN_UP(kernel_high, 64 * KiB);