From: Herve Codina <herve.codina@bootlin.com>
To: Haotian Zhang <vulab@iscas.ac.cn>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, thomas.petazzoni@bootlin.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] net: wan: framer: pef2256: Switch to devm_mfd_add_devices()
Date: Mon, 3 Nov 2025 13:39:58 +0100 [thread overview]
Message-ID: <20251103133958.7c9d5003@bootlin.com> (raw)
In-Reply-To: <20251103123741.721-1-vulab@iscas.ac.cn>
Hi Haotian,
On Mon, 3 Nov 2025 20:37:41 +0800
Haotian Zhang <vulab@iscas.ac.cn> 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")
> Suggested-by: Herve Codina<herve.codina@bootlin.com>
> Signed-off-by: Haotian Zhang <vulab@iscas.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);
> if (ret) {
> dev_err(pef2256->dev, "add devices failed (%d)\n", ret);
Thanks for your update.
Acked-by: Herve Codina <herve.codina@bootlin.com>
Best regards,
Hervé
next prev parent reply other threads:[~2025-11-03 12:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-03 11:18 [PATCH] net: wan: framer: pef2256: Fix missing mfd_remove_devices() call Haotian Zhang
2025-11-03 11:43 ` Herve Codina
2025-11-03 12:37 ` [PATCH v2] net: wan: framer: pef2256: Switch to devm_mfd_add_devices() Haotian Zhang
2025-11-03 12:39 ` Herve Codina [this message]
2025-11-05 1:49 ` Jakub Kicinski
2025-11-05 3:47 ` [PATCH v3] " Haotian Zhang
2025-11-05 7:34 ` Herve Codina
2025-11-06 2:10 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251103133958.7c9d5003@bootlin.com \
--to=herve.codina@bootlin.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=vulab@iscas.ac.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.