From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>
Cc: Bin Liu <b-liu@ti.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] usb: musb: da8xx: depopulate OF children on teardown
Date: Fri, 17 Jul 2026 11:44:23 +0200 [thread overview]
Message-ID: <2026071745-award-affair-a332@gregkh> (raw)
In-Reply-To: <20260715135916.24417-4-pengpeng@iscas.ac.cn>
On Wed, Jul 15, 2026 at 09:57:50PM +0800, Pengpeng Hou wrote:
> da8xx_probe() populates OF child devices before registering the MUSB
> platform device. If the later MUSB device registration fails, those
> children remain registered. The remove path also leaves the populated
> children behind.
>
> Depopulate the children when MUSB device registration fails and after
> unregistering the MUSB device during remove.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
> Changes since v1: https://lore.kernel.org/all/20260616005819.11232-1-pengpeng@iscas.ac.cn/
> - keep the existing of_platform_populate() error unwind target, so both
> labels remain used and the patch does not introduce an unused-label
> warning
> - limit the commit message to paths where population has succeeded
> ---
> drivers/usb/musb/da8xx.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
> index 4209f43..0c098a4 100644
> --- a/drivers/usb/musb/da8xx.c
> +++ b/drivers/usb/musb/da8xx.c
> @@ -577,11 +577,13 @@ static int da8xx_probe(struct platform_device *pdev)
> ret = PTR_ERR_OR_ZERO(glue->musb);
> if (ret) {
> dev_err(&pdev->dev, "failed to register musb device: %d\n", ret);
> - goto err_unregister_phy;
> + goto err_depopulate;
> }
>
> return 0;
>
> +err_depopulate:
> + of_platform_depopulate(&pdev->dev);
> err_unregister_phy:
> usb_phy_generic_unregister(glue->usb_phy);
> return ret;
> @@ -592,6 +594,7 @@ static void da8xx_remove(struct platform_device *pdev)
> struct da8xx_glue *glue = platform_get_drvdata(pdev);
>
> platform_device_unregister(glue->musb);
> + of_platform_depopulate(&pdev->dev);
This implies that this has always been a bug for the normal remove path?
How has this never shown up anywhere?
So shouldn't this be 2 different patches, there are 2 different bugs
here, right?
thanks,
greg k-h
prev parent reply other threads:[~2026-07-17 9:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 13:57 [PATCH v2] usb: musb: da8xx: depopulate OF children on teardown Pengpeng Hou
2026-07-17 9:44 ` Greg Kroah-Hartman [this message]
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=2026071745-award-affair-a332@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=b-liu@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=pengpeng@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox