On Tue, Nov 11 2025, Anshul Dalal <[email protected]> wrote:

>>  int part_get_type_by_name(const char *name)
>>  {
>>      struct part_driver *drv =
>> @@ -322,12 +344,9 @@ int part_get_info_by_type(struct blk_desc *desc, int 
>> part, int part_type,
>>                        struct disk_partition *info)
>>  {
>>      struct part_driver *drv;
>> +    int ret = -ENOENT;
>>  
>>      if (blk_enabled()) {
>> -            /* The common case is no UUID support */
>> -            disk_partition_clr_uuid(info);
>> -            disk_partition_clr_type_guid(info);
>> -
>>              if (part_type == PART_TYPE_UNKNOWN) {
>>                      drv = part_driver_lookup_type(desc);
>>              } else {
>> @@ -339,18 +358,16 @@ int part_get_info_by_type(struct blk_desc *desc, int 
>> part, int part_type,
>>                            desc->part_type);
>>                      return -EPROTONOSUPPORT;
>>              }
>> -            if (!drv->get_info) {
>> -                    PRINTF("## Driver %s does not have the get_info() 
>> method\n",
>> -                           drv->name);
>> -                    return -ENOSYS;
>> -            }
>> -            if (drv->get_info(desc, part, info) == 0) {
>> +
>> +            ret = part_driver_get_info(drv, desc, part, info);
>> +            if (ret && ret != -ENOSYS) {
>> +                    ret = -ENOENT;
>
> Why are we overwriting the err code from part_driver_get_info here?

That's essentially what the code did originally (it only returned 0 in
case ->get_info returned 0, otherwise it fell through to the "return
-ENOENT" at the bottom). And it turns out that that behaviour is
expected by lots of tests; when I inadvertently changed that logic in v2
to actually propagate whatever error ->get_info returned, lots of tests
broke:

https://lore.kernel.org/u-boot/20251107201927.GA2243313@bill-the-cat/

And this is the only difference between v2 and v3, I tweaked this so it
would preserve that "either success or -ENOENT [or -ENOSYS]" behaviour.

Rasmus

Reply via email to