Skip to content

Commit 6639a9c

Browse files
ISCAS-Vulabgregkh
authored andcommitted
net: wan: framer: pef2256: Switch to devm_mfd_add_devices()
[ Upstream commit 4d6ec3a ] The driver calls mfd_add_devices() but fails to call mfd_remove_devices() in error paths after successful MFD device registration and in the remove function. This leads to resource leaks where MFD child devices are not properly unregistered. Replace mfd_add_devices with devm_mfd_add_devices to automatically manage the device resources. Fixes: c96e976 ("net: wan: framer: Add support for the Lantiq PEF2256 framer") Suggested-by: Herve Codina <herve.codina@bootlin.com> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn> Acked-by: Herve Codina <herve.codina@bootlin.com> Link: https://patch.msgid.link/20251105034716.662-1-vulab@iscas.ac.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent fbc6037 commit 6639a9c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/net/wan/framer/pef2256/pef2256.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,8 @@ static int pef2256_add_audio_devices(struct pef2256 *pef2256)
637637
audio_devs[i].id = i;
638638
}
639639

640-
ret = mfd_add_devices(pef2256->dev, 0, audio_devs, count, NULL, 0, NULL);
640+
ret = devm_mfd_add_devices(pef2256->dev, 0, audio_devs, count,
641+
NULL, 0, NULL);
641642
kfree(audio_devs);
642643
return ret;
643644
}
@@ -812,8 +813,8 @@ static int pef2256_probe(struct platform_device *pdev)
812813

813814
platform_set_drvdata(pdev, pef2256);
814815

815-
ret = mfd_add_devices(pef2256->dev, 0, pef2256_devs,
816-
ARRAY_SIZE(pef2256_devs), NULL, 0, NULL);
816+
ret = devm_mfd_add_devices(pef2256->dev, 0, pef2256_devs,
817+
ARRAY_SIZE(pef2256_devs), NULL, 0, NULL);
817818
if (ret) {
818819
dev_err(pef2256->dev, "add devices failed (%d)\n", ret);
819820
return ret;

0 commit comments

Comments
 (0)