[PATCH v1 8/8] efi/dev-path-parser: Refactor _UID handling to use acpi_dev_uid_to_integer()

Andy Shevchenko andriy.shevchenko at linux.intel.com
Thu Sep 8 03:06:34 PDT 2022


On Thu, Sep 08, 2022 at 10:20:47AM +0200, Ard Biesheuvel wrote:
> On Wed, 7 Sept 2022 at 18:57, Andy Shevchenko
> <andriy.shevchenko at linux.intel.com> wrote:

...

> >         for_each_acpi_dev_match(adev, hid, NULL, -1) {
> > -               if (adev->pnp.unique_id && !strcmp(adev->pnp.unique_id, uid))
> > +               ret = acpi_dev_uid_to_integer(adev, &uid);
> > +               if (ret == -ENODATA && node->acpi.uid == 0)
> >                         break;
> > -               if (!adev->pnp.unique_id && node->acpi.uid == 0)
> > +               if (ret == 0 && node->acpi.uid == uid)
> 
> Is it necessary to reorder the conditions here? I.e., why not

Code-wise there should be not much difference which does not affect the flow,
I think I moved it to be closer to the pattern "let's handle errors first",
but in this case I'm fine with your proposal.

> > +               ret = acpi_dev_uid_to_integer(adev, &uid);
> > +               if (ret == 0 && node->acpi.uid == uid)
> >                         break;
> > +               if (ret == -ENODATA && node->acpi.uid == 0)
> >                         break;
> 
> ?
> 
> With that fixed,
> 
> Reviewed-by: Ard Biesheuvel <ardb at kernel.org>

Thanks!

-- 
With Best Regards,
Andy Shevchenko





More information about the linux-arm-kernel mailing list