* [PATCH] efi_driver: fix duplicate efiblk#0 issue
@ 2023-07-03 2:47 Masahisa Kojima
2023-07-03 4:32 ` AKASHI Takahiro
2023-07-03 6:11 ` Heinrich Schuchardt
0 siblings, 2 replies; 5+ messages in thread
From: Masahisa Kojima @ 2023-07-03 2:47 UTC (permalink / raw)
To: u-boot; +Cc: Heinrich Schuchardt, Ilias Apalodimas, Masahisa Kojima
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 */
name = calloc(1, 18); /* strlen("efiblk#2147483648") + 1 */
if (!name)
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] efi_driver: fix duplicate efiblk#0 issue
2023-07-03 2:47 [PATCH] efi_driver: fix duplicate efiblk#0 issue Masahisa Kojima
@ 2023-07-03 4:32 ` AKASHI Takahiro
2023-07-03 5:33 ` Masahisa Kojima
2023-07-03 6:11 ` Heinrich Schuchardt
1 sibling, 1 reply; 5+ messages in thread
From: AKASHI Takahiro @ 2023-07-03 4:32 UTC (permalink / raw)
To: Masahisa Kojima; +Cc: u-boot, Heinrich Schuchardt, Ilias Apalodimas
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
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] efi_driver: fix duplicate efiblk#0 issue
2023-07-03 4:32 ` AKASHI Takahiro
@ 2023-07-03 5:33 ` Masahisa Kojima
0 siblings, 0 replies; 5+ messages in thread
From: Masahisa Kojima @ 2023-07-03 5:33 UTC (permalink / raw)
To: AKASHI Takahiro, Masahisa Kojima, u-boot, Heinrich Schuchardt,
Ilias Apalodimas
Hi Akashi-san,
On Mon, 3 Jul 2023 at 13:32, AKASHI Takahiro <takahiro.akashi@linaro.org> wrote:
>
> 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.
Yes, it is much simpler.
I will revise the patch.
Thanks,
Masahisa Kojima
>
> -Takahiro Akashi
>
> > name = calloc(1, 18); /* strlen("efiblk#2147483648") + 1 */
> > if (!name)
> > --
> > 2.34.1
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] efi_driver: fix duplicate efiblk#0 issue
2023-07-03 2:47 [PATCH] efi_driver: fix duplicate efiblk#0 issue Masahisa Kojima
2023-07-03 4:32 ` AKASHI Takahiro
@ 2023-07-03 6:11 ` Heinrich Schuchardt
2023-07-03 6:14 ` Masahisa Kojima
1 sibling, 1 reply; 5+ messages in thread
From: Heinrich Schuchardt @ 2023-07-03 6:11 UTC (permalink / raw)
To: Masahisa Kojima; +Cc: Ilias Apalodimas, u-boot
On 7/3/23 04:47, 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 */
Shouldn't we simply use blk_next_free_devnum() instead of duplicating
the logic here?
Best regards
Heinrich
>
> name = calloc(1, 18); /* strlen("efiblk#2147483648") + 1 */
> if (!name)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] efi_driver: fix duplicate efiblk#0 issue
2023-07-03 6:11 ` Heinrich Schuchardt
@ 2023-07-03 6:14 ` Masahisa Kojima
0 siblings, 0 replies; 5+ messages in thread
From: Masahisa Kojima @ 2023-07-03 6:14 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: Ilias Apalodimas, u-boot
Hi Heinrich,
On Mon, 3 Jul 2023 at 15:10, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On 7/3/23 04:47, 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 */
>
> Shouldn't we simply use blk_next_free_devnum() instead of duplicating
> the logic here?
Yes, Akashi-san also already pointed out, and I already sent v2 with
blk_next_free_devnum().
Thanks,
Masahisa Kojima
>
> Best regards
>
> Heinrich
>
> >
> > name = calloc(1, 18); /* strlen("efiblk#2147483648") + 1 */
> > if (!name)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-03 6:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-03 2:47 [PATCH] efi_driver: fix duplicate efiblk#0 issue Masahisa Kojima
2023-07-03 4:32 ` AKASHI Takahiro
2023-07-03 5:33 ` Masahisa Kojima
2023-07-03 6:11 ` Heinrich Schuchardt
2023-07-03 6:14 ` Masahisa Kojima
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.