Commit 3bfc213d authored by Felix Gu's avatar Felix Gu Committed by Conor Dooley
Browse files

soc: microchip: mpfs-mss-top-sysreg: 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: 4aac11c9 ("soc: microchip: add mfd drivers for two syscon regions on PolarFire SoC")
Signed-off-by: default avatarFelix Gu <ustc.gu@gmail.com>
Signed-off-by: default avatarConor Dooley <conor.dooley@microchip.com>
parent 27459f86
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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;