diff options
| author | Bastien Curutchet <bastien.curutchet@bootlin.com> | 2025-08-20 16:21:13 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-11-13 15:34:08 -0500 |
| commit | 67e8a4d0532330cb8ac21a8400efb9c6001e424f (patch) | |
| tree | 489359b63d151b5a70b4edd6a0157d7c3ef1215c /drivers/mfd | |
| parent | 933fc45da2777c232f6ec11c0cd8d224ed6f0ed8 (diff) | |
| download | linux-67e8a4d0532330cb8ac21a8400efb9c6001e424f.tar.gz linux-67e8a4d0532330cb8ac21a8400efb9c6001e424f.tar.bz2 linux-67e8a4d0532330cb8ac21a8400efb9c6001e424f.zip | |
mfd: core: Increment of_node's refcount before linking it to the platform device
[ Upstream commit 5f4bbee069836e51ed0b6d7e565a292f070ababc ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/mfd')
| -rw-r--r-- | drivers/mfd/mfd-core.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 76bd316a50af..7d14a1e7631e 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -131,6 +131,7 @@ allocate_of_node: of_entry->np = np; list_add_tail(&of_entry->list, &mfd_of_node_list); + of_node_get(np); device_set_node(&pdev->dev, of_fwnode_handle(np)); #endif return 0; |
