All of lore.kernel.org
 help / color / mirror / Atom feed
From: Francesco Lavra <francescolavra.fl@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [PATCH 6/7] add ARM Linux loader
Date: Sun, 07 Apr 2013 23:17:46 +0200	[thread overview]
Message-ID: <5161E27A.5050009@gmail.com> (raw)
In-Reply-To: <CAF7UmSzJHKWawOXAx9v1HrvewrdgEoJpEuAiijqoJY=s0Xp_zg@mail.gmail.com>

Hi, I noticed another minor issue in this patch.

On 03/24/2013 06:01 PM, Leif Lindholm wrote:
> --- grub-core/loader/arm/linux.c	1970-01-01 00:00:00 +0000
> +++ grub-core/loader/arm/linux.c	2013-03-24 13:49:04 +0000
[...]
> +static grub_err_t
> +grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
> +		 int argc, char *argv[])
> +{
> +  grub_file_t file;
> +  int size;
> +
> +  if (argc == 0)
> +    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
> +
> +  file = grub_file_open (argv[0]);
> +  if (!file)
> +    return grub_errno;
> +
> +  size = grub_file_size (file);
> +  if (size == 0)
> +    goto fail;
> +
> +#ifdef GRUB_MACHINE_EFI
> +  initrd_start = (grub_addr_t) grub_efi_allocate_loader_memory (LINUX_INITRD_PHYS_OFFSET, size);
> +#else
> +  initrd_start = LINUX_INITRD_ADDRESS;
> +#endif
> +  grub_dprintf ("loader", "Loading initrd to 0x%08x\n",
> +		(grub_addr_t) initrd_start);
> +
> +  if (grub_file_read (file, (void *) initrd_start, size) != size)
> +    goto fail;
> +
> +  initrd_end = initrd_start + size;
> +
> +  return GRUB_ERR_NONE;

The file should be closed also if the initrd is successfully loaded.

> +
> +fail:
> +  grub_file_close (file);
> +
> +  return grub_errno;
> +}

--
Francesco


      parent reply	other threads:[~2013-04-07 21:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-24 17:01 [PATCH 6/7] add ARM Linux loader Leif Lindholm
2013-04-01 16:18 ` Francesco Lavra
2013-04-03 17:30   ` Leif Lindholm
2013-04-07 21:17 ` Francesco Lavra [this message]

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=5161E27A.5050009@gmail.com \
    --to=francescolavra.fl@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=leif.lindholm@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.