Skip to content

Commit 5f4bbee

Browse files
bastien-curutchetlag-linaro
authored andcommitted
mfd: core: Increment of_node's refcount before linking it to the platform device
When an MFD device is added, a platform_device is allocated. If this device is linked to a DT description, the corresponding OF node is linked to the new platform device but the OF node's refcount isn't incremented. As of_node_put() is called during the platform device release, it leads to a refcount underflow. Call of_node_get() to increment the OF node's refcount when the node is linked to the newly created platform device. Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com> Link: https://lore.kernel.org/r/20250820-mfd-refcount-v1-1-6dcb5eb41756@bootlin.com Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 8a49818 commit 5f4bbee

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/mfd/mfd-core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ static int mfd_match_of_node_to_dev(struct platform_device *pdev,
131131
of_entry->np = np;
132132
list_add_tail(&of_entry->list, &mfd_of_node_list);
133133

134+
of_node_get(np);
134135
device_set_node(&pdev->dev, of_fwnode_handle(np));
135136
#endif
136137
return 0;

0 commit comments

Comments
 (0)