aboutsummaryrefslogtreecommitdiff
path: root/hw/i386
diff options
context:
space:
mode:
authorSergio Lopez <slp@redhat.com>2019-10-10 15:57:17 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2019-10-22 09:38:42 +0200
commit350f5233d755cb00e62ccadc7635435ac3238aa6 (patch)
tree201068f23a567cf7b6faf5401b86c2350a58f6a8 /hw/i386
parent133ef074bd88957c0ed5b38d4489111889acf915 (diff)
downloadqemu-350f5233d755cb00e62ccadc7635435ac3238aa6.zip
qemu-350f5233d755cb00e62ccadc7635435ac3238aa6.tar.gz
qemu-350f5233d755cb00e62ccadc7635435ac3238aa6.tar.bz2
hw/i386/pc: avoid an assignment in if condition in x86_load_linux()
Follow checkpatch.pl recommendation and avoid an assignment in if condition in x86_load_linux(). Signed-off-by: Sergio Lopez <slp@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'hw/i386')
-rw-r--r--hw/i386/pc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index b5b660f..77198d5 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",