[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251104174919.5fc6eb00@kernel.org>
Date: Tue, 4 Nov 2025 17:49:19 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Haotian Zhang <vulab@...as.ac.cn>
Cc: herve.codina@...tlin.com, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, thomas.petazzoni@...tlin.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] net: wan: framer: pef2256: Switch to
devm_mfd_add_devices()
On Mon, 3 Nov 2025 20:37:41 +0800 Haotian Zhang wrote:
> 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: c96e976d9a05 ("net: wan: framer: Add support for the Lantiq PEF2256 framer")
This commit has another call to mfd_add_devices()
please add an explanation of why that one is fine as is.
> Suggested-by: Herve Codina<herve.codina@...tlin.com>
missing space between name and address
> Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
> ---
> Changes in v2:
> - Use devm_mfd_add_devices() instead of manual cleanup
> ---
> drivers/net/wan/framer/pef2256/pef2256.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wan/framer/pef2256/pef2256.c b/drivers/net/wan/framer/pef2256/pef2256.c
> index 1e4c8e85d598..4f4433560964 100644
> --- a/drivers/net/wan/framer/pef2256/pef2256.c
> +++ b/drivers/net/wan/framer/pef2256/pef2256.c
> @@ -812,7 +812,7 @@ static int pef2256_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, pef2256);
>
> - ret = mfd_add_devices(pef2256->dev, 0, pef2256_devs,
> + ret = devm_mfd_add_devices(pef2256->dev, 0, pef2256_devs,
> ARRAY_SIZE(pef2256_devs), NULL, 0, NULL);
please adjust the continuation line so that it aligns with the opening
bracket
--
pw-bot: cr
Powered by blists - more mailing lists