[U-Boot] [PATCH 1/1] core/uclass: uclass_get_device_tail: always set devp

Simon Glass
2017-04-19T00:12:52Z

Hi,

On 18 April 2017 at 12:44, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> Set devp even if probing fails.
>
> Without the patch the following problem occurs:
> If the first block device is not probed successfully no block
> device is passed by bootefi to the EFI executable.
>
> The problem was reported by Andreas Färber in
> https://lists.denx.de/pipermail/u-boot/2017-April/287432.html
>
> For testing I used an odroid-c2 with a dts including
> &sd_emmc_a {
> status = "okay";
> }
> This device does not exist on the board and cannot be initialized.

Thanks for finding this. Which function is calling this? Can you
please explain the call sequence to hit this problem? I am worried
that something else is wrong.

>
> Reported-by: Andreas Färber <afaerber@suse.de>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> drivers/core/uclass.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
> index 04fb45b..b647384 100644
> --- a/drivers/core/uclass.c
> +++ b/drivers/core/uclass.c
> @@ -349,12 +349,13 @@ int uclass_get_device_tail(struct udevice *dev, int ret,
> return ret;
>
> assert(dev);
> +
> + *devp = dev;
> +
> ret = device_probe(dev);
> if (ret)
> return ret;
>
> - *devp = dev;
> -
> return 0;
> }
>
> --
> 2.1.4
>

Regards,
Simon