From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Felipe Balbi <balbi@ti.com>,
Peter Griffin <peter.griffin@linaro.org>,
Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Lee Jones <lee@kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH 2/2] usb: dwc3: st: add missing depopulate in probe error path
Date: Wed, 14 Aug 2024 23:19:56 +0000 [thread overview]
Message-ID: <20240814231951.k3ejoyno2ogcvsee@synopsys.com> (raw)
In-Reply-To: <20240814093957.37940-2-krzysztof.kozlowski@linaro.org>
On Wed, Aug 14, 2024, Krzysztof Kozlowski wrote:
> Depopulate device in probe error paths to fix leak of children
> resources.
>
> Fixes: f83fca0707c6 ("usb: dwc3: add ST dwc3 glue layer to manage dwc3 HC")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>
> ---
>
> Context of my other cleanup patches (separate series to be sent soon)
> will depend on this.
> ---
> drivers/usb/dwc3/dwc3-st.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c
> index a9cb04043f08..c8c7cd0c1796 100644
> --- a/drivers/usb/dwc3/dwc3-st.c
> +++ b/drivers/usb/dwc3/dwc3-st.c
> @@ -266,7 +266,7 @@ static int st_dwc3_probe(struct platform_device *pdev)
> if (!child_pdev) {
> dev_err(dev, "failed to find dwc3 core device\n");
> ret = -ENODEV;
> - goto err_node_put;
> + goto depopulate;
> }
>
> dwc3_data->dr_mode = usb_get_dr_mode(&child_pdev->dev);
> @@ -282,6 +282,7 @@ static int st_dwc3_probe(struct platform_device *pdev)
> ret = st_dwc3_drd_init(dwc3_data);
> if (ret) {
> dev_err(dev, "drd initialisation failed\n");
> + of_platform_depopulate(dev);
> goto undo_softreset;
> }
>
> @@ -291,6 +292,8 @@ static int st_dwc3_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, dwc3_data);
> return 0;
>
> +depopulate:
> + of_platform_depopulate(dev);
> err_node_put:
> of_node_put(child);
> undo_softreset:
> --
> 2.43.0
>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Thanks,
Thinh
next prev parent reply other threads:[~2024-08-14 23:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 9:39 [PATCH 1/2] usb: dwc3: st: fix probed platform device ref count on " Krzysztof Kozlowski
2024-08-14 9:39 ` [PATCH 2/2] usb: dwc3: st: add missing depopulate in " Krzysztof Kozlowski
2024-08-14 15:40 ` Patrice CHOTARD
2024-08-14 23:19 ` Thinh Nguyen [this message]
2024-08-14 15:34 ` [PATCH 1/2] usb: dwc3: st: fix probed platform device ref count on " Patrice CHOTARD
2024-08-14 23:11 ` Thinh Nguyen
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=20240814231951.k3ejoyno2ogcvsee@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=patrice.chotard@foss.st.com \
--cc=peppe.cavallaro@st.com \
--cc=peter.griffin@linaro.org \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®