Re: [PATCH v1 8/8] efi/dev-path-parser: Refactor _UID handling to use acpi_dev_uid_to_integer()
From: Andy Shevchenko
Date: Thu Sep 08 2022 - 06:06:55 EST
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@xxxxxxxxxxxxxxx> 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@xxxxxxxxxx>
Thanks!
--
With Best Regards,
Andy Shevchenko