All of lore.kernel.org
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Masahisa Kojima <masahisa.kojima@linaro.org>
Cc: u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>
Subject: Re: [PATCH] efi_driver: fix duplicate efiblk#0 issue
Date: Mon, 3 Jul 2023 13:32:28 +0900	[thread overview]
Message-ID: <ZKJPXC1rAS9wTHAk@laputa> (raw)
In-Reply-To: <20230703024718.309452-1-masahisa.kojima@linaro.org>

On Mon, Jul 03, 2023 at 11:47:18AM +0900, Masahisa Kojima wrote:
> The devnum value of the blk_desc structure starts from 0,
> current efi_bl_create_block_device() function creates
> two "efiblk#0" devices for the cases that blk_find_max_devnum()
> returns -ENODEV and blk_find_max_devnum() returns 0(one device
> found in this case).
> 
> The devnum value for the "efiblk" name needs to be incremented.
> 
> Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
> ---
>  lib/efi_driver/efi_block_device.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c
> index add00eeebb..e37bfe6e80 100644
> --- a/lib/efi_driver/efi_block_device.c
> +++ b/lib/efi_driver/efi_block_device.c
> @@ -129,6 +129,8 @@ efi_bl_create_block_device(efi_handle_t handle, void *interface)
>  		devnum = 0;
>  	else if (devnum < 0)
>  		return EFI_OUT_OF_RESOURCES;
> +	else
> +		devnum++; /* device found, note that devnum starts from 0 */

So we can use blk_next_free_devnum() instead.

-Takahiro Akashi

>  	name = calloc(1, 18); /* strlen("efiblk#2147483648") + 1 */
>  	if (!name)
> -- 
> 2.34.1
> 

  reply	other threads:[~2023-07-03  4:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03  2:47 [PATCH] efi_driver: fix duplicate efiblk#0 issue Masahisa Kojima
2023-07-03  4:32 ` AKASHI Takahiro [this message]
2023-07-03  5:33   ` Masahisa Kojima
2023-07-03  6:11 ` Heinrich Schuchardt
2023-07-03  6:14   ` Masahisa Kojima

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=ZKJPXC1rAS9wTHAk@laputa \
    --to=takahiro.akashi@linaro.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=masahisa.kojima@linaro.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /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.