[U-Boot] [PATCH] dm: core: don't fail to iterate if first one fails to probe

Simon Glass sjg at chromium.org
Thu Aug 3 15:24:13 UTC 2017


Hi Rob,

On 19 July 2017 at 10:53, Rob Clark <robdclark at gmail.com> wrote:
> On Thu, Jul 13, 2017 at 3:10 PM, Simon Glass <sjg at chromium.org> wrote:
>> Hi Rob,
>>
>> On 21 June 2017 at 04:52, Rob Clark <robdclark at gmail.com> wrote:
>>> On Wed, Jun 21, 2017 at 6:23 AM, Peter Robinson <pbrobinson at gmail.com> wrote:
>>>> On Tue, Jun 20, 2017 at 10:49 PM, Rob Clark <robdclark at gmail.com> wrote:
>>>>> efi_disk_register() would try to iterate all the blk devices.  But if
>>>>> the first one in the list failed to probe, uclass_first_device() would
>>>>> return NULL and no attempt would be made to register the remaining
>>>>> devices.  Also uclass_next_device() needs the same fix.
>>>>
>>>> This looks related/similar to the "efi_loader: disk: iterate only over
>>>> valid block devices" patch [1]
>>>>
>>>
>>> hmm, I don't see uclass_first_device_check() which I guess must be
>>> part of another in-flight patch?  I don't mind too much *how* we fix
>>> it, as long as it works.  (Although it seems more sensible to just
>>> make uclass_first_device()/etc dtrt rather than introducing another
>>> function that actually works properly.. but that is only my $0.02)
>>
>> That patch is now in mainline. It was delayed for a release as I did
>> not get any reviews and so wasn't sure if it was needed.
>>
>> I believe the common case is wanting to stop on error, since it means
>> something is wrong. The case of continuing onto another device when
>> the first one fails is unusual. We should always check return codes
>> and return errors when something is wrong.
>>
>> I believe this case is happening because the device is removable and
>> therefore returns an error. Is that right? If so then we should return
>> a single error, such as -ENOMEDIUM so that the caller can ignore that
>> error, or consider it OK.
>
> yes, iirc, the first one ended up being sd-card (which was removed)..
> I'll have to check if driver is properly returning -ENOMEDIUM.  In
> which case maybe the right thing to do is for the iterators skip over
> just that single error code, since it isn't really an "unusual" error.

OK that sounds better. Suppressing errors should be done with care.

Regards,
Simon


More information about the U-Boot mailing list