[PATCH] blk: Check if_type in blk_get_devnum_by_typename

Simon Glass sjg at chromium.org
Fri Dec 27 17:41:53 CET 2019


Hi Juha,

On Sun, 24 Nov 2019 at 16:57, Juha Sarlin <jsub at sarlin.mobi> wrote:
>
>
> > On 24 Nov 2019, at 19:37, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
> >
> > On 11/24/19 7:09 PM, Juha Sarlin wrote:
> >> While searching for a BLK device, this function checks only for a
> >> matching devnum. It should check if_type, too.
> >
> > Could you, please, describe in which cases you have observed a problem
> > and how it can be reproduced.
> >
> > According to the function description the relevant interface type check is
> > device_get_uclass_id(dev->parent) != uclass_id
>
> I was wrong, it isn't really a bug. I was misled by all the other blk-finding functions that check if_type instead of parent class. I think that checking if_type would work here, too.
>
> Or perhaps this case is the first step towards removing the if_type field in the future? There seems to be a 1-1 mapping from almost every if_type to uclass_id.
>

Thanks for the patch. In this case it is the intended behaviour I
think, because if_type_to_uclass_id() gives us the uclass to use, and
we check that immediately below your patch. Since there is a 1:1
correspondence between if_type and uclass_id (apart from those we want
to remove) we don't need to check both.

Yes it would be nice to remove if_type one day.

Regards,
Simon


More information about the U-Boot mailing list