On Wed, May 26, 2021 at 1:29 AM Daniel Scally <djrscally(a)gmail.com> wrote:
On 20/05/2021 20:40, Rafael J. Wysocki wrote:
> On Thu, May 20, 2021 at 9:13 PM Rafael J. Wysocki <rafael(a)kernel.org> wrote:
>> On Wed, May 19, 2021 at 11:19 PM Andy Shevchenko
>> <andy.shevchenko(a)gmail.com> wrote:
>>> Currently it's possible to iterate over the dangling pointer in case the
device
>>> suddenly disappears. This may happen becase callers put it at the end of a
loop.
>>>
>>> Instead, let's move that call inside acpi_dev_get_next_match_dev().
>> Not really.
> OK, I see what you want to achieve and the macro is actually buggy,
> because it leaves unbalanced references behind.
Yeah; I guess the originally intended use (which was "get all these
devices") doesn't really tally with the naming or with the operation of
similar functions in the kernel like the fwnode_handle ops; sorry about
that. Anyway; I think Andy's fix is the right way to do it, so the
calling code's responsible for holding onto a reference if it wants to
keep it.
I think we need to postpone the fix till v5.14-rc1 is out. It appears
that some code has been changed in EFI and media subsystems so that
patch will be in conflict with.
--
With Best Regards,
Andy Shevchenko