Skip to contentSkip to conversation

soc: microchip: mpfs: Fix resource leak on driver unbind

PATCH Applied Felix Gu 2 participants 4 messages Mar 9

Subsystems (3)
lore
Share & tools
lore

Felix Gu

author
#0 lore raw

cover soc: microchip: mpfs: Fix resource leak on driver unbind

---
Felix Gu (2):
soc: microchip: mpfs-control-scb: Fix resource leak on driver unbind
soc: microchip: mpfs-mss-top-sysreg: Fix resource leak on driver unbind

 drivers/soc/microchip/mpfs-control-scb.c    | 6 ++++--
 drivers/soc/microchip/mpfs-mss-top-sysreg.c | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

---
base-commit: a0ae2a256046c0c5d3778d1a194ff2e171f16e5f
change-id: 20260309-mpfs-d0f8ce74b879

Best regards,

Signature · 1 line
Felix Gu <[email protected]>
author
#1 lore raw

PATCH 1/2 soc: microchip: mpfs-control-scb: Fix resource leak on driver unbind

Use devm_mfd_add_devices() instead of mfd_add_devices() to ensure child devices are properly removed when the driver unbinds.

Fixes 4aac11c9a6e7 ("soc: microchip: add mfd drivers for two syscon regions on PolarFire SoC")
---
 drivers/soc/microchip/mpfs-control-scb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/soc/microchip/mpfs-control-scb.c +4 -2
index f0b84b1f49cb..8dda5704a389 100644
@@ -14,8 +14,10 @@ static int mpfs_control_scb_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 
-	return mfd_add_devices(dev, PLATFORM_DEVID_NONE, mpfs_control_scb_devs,
-			       ARRAY_SIZE(mpfs_control_scb_devs), NULL, 0, NULL);
+	return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
+				    mpfs_control_scb_devs,
+				    ARRAY_SIZE(mpfs_control_scb_devs), NULL, 0,
+				    NULL);
 }
 
 static const struct of_device_id mpfs_control_scb_of_match[] = {
Signature · 1 line
2.43.0
author
#2 lore raw

PATCH 2/2 soc: microchip: mpfs-mss-top-sysreg: Fix resource leak on driver unbind

In reply to Felix Gu

Use devm_mfd_add_devices() instead of mfd_add_devices() to ensure child devices are properly removed when the driver unbinds.

Fixes 4aac11c9a6e7 ("soc: microchip: add mfd drivers for two syscon regions on PolarFire SoC")
---
 drivers/soc/microchip/mpfs-mss-top-sysreg.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/soc/microchip/mpfs-mss-top-sysreg.c +4 -2
index b2244e44ff0f..b0f42b8dd3ed 100644
@@ -16,8 +16,10 @@ static int mpfs_mss_top_sysreg_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	int ret;
 
-	ret = mfd_add_devices(dev, PLATFORM_DEVID_NONE, mpfs_mss_top_sysreg_devs,
-			      ARRAY_SIZE(mpfs_mss_top_sysreg_devs) , NULL, 0, NULL);
+	ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
+				   mpfs_mss_top_sysreg_devs,
+				   ARRAY_SIZE(mpfs_mss_top_sysreg_devs), NULL,
+				   0, NULL);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.43.0