[U-Boot] [PATCH] blk: Check if_type in blk_get_devnum_by_typename

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Nov 24 18:37:31 UTC 2019


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

>
> Signed-off-by: Juha Sarlin <jsub at sarlin.mobi>
> ---
>
>   drivers/block/blk-uclass.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
> index ca8978f0e1..78f2bcab09 100644
> --- a/drivers/block/blk-uclass.c
> +++ b/drivers/block/blk-uclass.c
> @@ -112,7 +112,7 @@ struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, int devnum)

Should the logic need changing, please, update the function description.
Please, use Sphinx style for the function description.

Best regards

Heinrich

>
>   		debug("%s: if_type=%d, devnum=%d: %s, %d, %d\n", __func__,
>   		      if_type, devnum, dev->name, desc->if_type, desc->devnum);
> -		if (desc->devnum != devnum)
> +		if (desc->if_type != if_type || desc->devnum != devnum)
>   			continue;
>
>   		/* Find out the parent device uclass */
>



More information about the U-Boot mailing list