[PATCH 5.10 481/491] device property: Retrieve fwnode from of_node via accessor

Greg Kroah-Hartman
2026-04-13T17:03:26Z

From: Andy Shevchenko <andy.shevchenko@gmail.com>

[ Upstream commit 3cd8015040d7537a6b88e26f36768a90d9247829 ]

OF provides a specific accessor to retrieve fwnode handle.
Use it instead of direct dereferencing.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Stable-dep-of: 2692c614f8f0 ("device property: Allow secondary lookup in fwnode_get_next_child_node()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/base/property.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -21,7 +21,7 @@
struct fwnode_handle *dev_fwnode(const struct device *dev)
{
return IS_ENABLED(CONFIG_OF) && dev->of_node ?
- &dev->of_node->fwnode : dev->fwnode;
+ of_fwnode_handle(dev->of_node) : dev->fwnode;
}
EXPORT_SYMBOL_GPL(dev_fwnode);

@@ -763,7 +763,7 @@ struct fwnode_handle *device_get_next_ch
struct fwnode_handle *fwnode = NULL, *next;

if (dev->of_node)
- fwnode = &dev->of_node->fwnode;
+ fwnode = of_fwnode_handle(dev->of_node);
else if (adev)
fwnode = acpi_fwnode_handle(adev);