[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c6150824-60d3-11ad-ba1a-e75d6a7a916e@linux.microsoft.com>
Date: Thu, 4 Jun 2020 13:57:01 -0700
From: Jordan Hand <jorhand@...ux.microsoft.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
linux-kernel@...r.kernel.org, linux-next@...r.kernel.org
Subject: Re: [PATCH] software node: recursively unregister child swnodes
On 6/4/20 1:15 PM, Greg Kroah-Hartman wrote:
> On Thu, Jun 04, 2020 at 12:36:23PM -0700, jorhand@...ux.microsoft.com wrote:
>> From: Jordan Hand <jorhand@...ux.microsoft.com>
>>
>> If a child swnode is unregistered after it's parent, it can lead to
>> undefined behavior.
>
> Crashing the system is not really "undefined" :)
Fair point :)
>
>> When a swnode is unregistered, recursively free it's children to avoid
>> this condition.
>
> Are you sure? Why would you be unregistering a child after it's parent?
> Why not just do not do that?
>
The main motivation for doing this was to support
`software_node_unregister_nodes` so that the passed list of nodes does
not need to be ordered in any particular way.
I suppose another way to do this would be to add a new function
`fwnode_remove_software_node_recursive` and just call that from
`software_node_unregister_nodes`.
That said, I suppose just ordering the nodes so that children come
before parents would also be fine. My thinking was just that accepting
any node ordering is simpler.
Thanks,
Jordan
Powered by blists - more mailing lists