[PATCH] efi_driver: fix duplicate efiblk#0 issue

Masahisa Kojima masahisa.kojima at linaro.org
Mon Jul 3 08:14:10 CEST 2023


Hi Heinrich,

On Mon, 3 Jul 2023 at 15:10, Heinrich Schuchardt <xypron.glpk at 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 at 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)
>


More information about the U-Boot mailing list