[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZN39I7w4ARc0WLnI@smile.fi.intel.com>
Date: Thu, 17 Aug 2023 13:57:39 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: "Peng Fan (OSS)" <peng.fan@....nxp.com>
Cc: robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org,
conor+dt@...nel.org, frowand.list@...il.com,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Peng Fan <peng.fan@....com>
Subject: Re: [PATCH] of/platform: increase refcount of fwnode
On Sat, Aug 12, 2023 at 08:24:11PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@....com>
>
> commit 0f8e5651095b
> ("of/platform: Propagate firmware node by calling device_set_node()")
> use of_fwnode_handle to replace of_node_get, which introduces a side
> effect that the refcount is not increased. Then the out of tree
> jailhouse hypervisor enable/disable test will trigger kernel dump in
> of_overlay_remove, with the following sequence
> "
> of_changeset_revert(&overlay_changeset);
> of_changeset_destroy(&overlay_changeset);
> of_overlay_remove(&overlay_id);
> "
>
> So increase the refcount to avoid issues.
I was thinking about this and it's kind quite a tricky thing.
So, let's go with your patch after some modifications, see below.
With that, feel free to add
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
...
> - device_set_node(&dev->dev, of_fwnode_handle(np));
> + device_set_node(&dev->dev, fwnode_handle_get(fwnode));
We know that we only handle OF node here, let's not involve other APIs,
so
device_set_node(&dev->dev, of_fwnode_handle(of_node_get(np)));
...
> - device_set_node(&dev->dev, of_fwnode_handle(node));
> + device_set_node(&dev->dev, fwnode_handle_get(fwnode));
Ditto.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists