linux16: Code cleanup

1. move relocator related code more close to each other
2. use variable "len" since it has correct assignment, and keep coding
style with upper code

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Cao jin 2018-08-07 14:57:53 +08:00 committed by Daniel Kiper
parent b607d2a79e
commit 5d7d13ce44

View file

@ -236,10 +236,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
(unsigned) real_size,
(unsigned) grub_linux16_prot_size);
relocator = grub_relocator_new ();
if (!relocator)
goto fail;
for (i = 1; i < argc; i++)
if (grub_memcmp (argv[i], "vga=", 4) == 0)
{
@ -299,6 +295,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
}
}
relocator = grub_relocator_new ();
if (!relocator)
goto fail;
{
grub_relocator_chunk_t ch;
err = grub_relocator_alloc_chunk_addr (relocator, &ch,
@ -355,8 +355,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
}
len = grub_linux16_prot_size;
if (grub_file_read (file, grub_linux_prot_chunk, grub_linux16_prot_size)
!= (grub_ssize_t) grub_linux16_prot_size && !grub_errno)
if (grub_file_read (file, grub_linux_prot_chunk, len) != len && !grub_errno)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
argv[0]);