[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v9 05/15] hw/i386/pc: avoid an assignment in if condition in x86_
From: |
Sergio Lopez |
Subject: |
[PATCH v9 05/15] hw/i386/pc: avoid an assignment in if condition in x86_load_linux() |
Date: |
Tue, 15 Oct 2019 13:23:36 +0200 |
Follow checkpatch.pl recommendation and avoid an assignment in if
condition in x86_load_linux().
Signed-off-by: Sergio Lopez <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/i386/pc.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index c8608b8007..90c2263a33 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1045,7 +1045,14 @@ static void x86_load_linux(PCMachineState *pcms,
/* load the kernel header */
f = fopen(kernel_filename, "rb");
- if (!f || !(kernel_size = get_file_size(f)) ||
+ if (!f) {
+ fprintf(stderr, "qemu: could not open kernel file '%s': %s\n",
+ kernel_filename, strerror(errno));
+ exit(1);
+ }
+
+ kernel_size = get_file_size(f);
+ if (!kernel_size ||
fread(header, 1, MIN(ARRAY_SIZE(header), kernel_size), f) !=
MIN(ARRAY_SIZE(header), kernel_size)) {
fprintf(stderr, "qemu: could not load kernel '%s': %s\n",
--
2.21.0
[PATCH v9 05/15] hw/i386/pc: avoid an assignment in if condition in x86_load_linux(),
Sergio Lopez <=
[PATCH v9 06/15] hw/i386/pc: remove commented out code from x86_load_linux(), Sergio Lopez, 2019/10/15
[PATCH v9 07/15] hw/i386/pc: move shared x86 functions to x86.c and export them, Sergio Lopez, 2019/10/15
[PATCH v9 08/15] hw/i386: split PCMachineState deriving X86MachineState from it, Sergio Lopez, 2019/10/15
[PATCH v9 09/15] hw/i386: make x86.c independent from PCMachineState, Sergio Lopez, 2019/10/15
[PATCH v9 10/15] fw_cfg: add "modify" functions for all types, Sergio Lopez, 2019/10/15
[PATCH v9 11/15] hw/intc/apic: reject pic ints if isa_pic == NULL, Sergio Lopez, 2019/10/15
[PATCH v9 13/15] docs/microvm.rst: document the new microvm machine type, Sergio Lopez, 2019/10/15
[PATCH v9 12/15] roms: add microvm-bios (qboot) as binary and git submodule, Sergio Lopez, 2019/10/15
[PATCH v9 15/15] MAINTAINERS: add microvm related files, Sergio Lopez, 2019/10/15