* [PATCH] usb: dwc3: qcom: Release the correct resources in dwc3_qcom_remove()
@ 2023-06-04 15:04 Christophe JAILLET
2023-06-08 17:09 ` Andrew Halaney
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2023-06-04 15:04 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Thinh Nguyen,
Greg Kroah-Hartman, Felipe Balbi, Lee Jones
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-arm-msm,
linux-usb
In the probe, some resources are allocated with
dwc3_qcom_of_register_core() or dwc3_qcom_acpi_register_core(). The
corresponding resources are already coorectly freed in the error handling
path of the probe, but not in the remove function.
Fix it.
Fixes: 2bc02355f8ba ("usb: dwc3: qcom: Add support for booting with ACPI")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/usb/dwc3/dwc3-qcom.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index aa96c473f839..9c95f1d909ba 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -942,11 +942,15 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
static void dwc3_qcom_remove(struct platform_device *pdev)
{
struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
+ struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
int i;
device_remove_software_node(&qcom->dwc3->dev);
- of_platform_depopulate(dev);
+ if (np)
+ of_platform_depopulate(&pdev->dev);
+ else
+ platform_device_put(pdev);
for (i = qcom->num_clocks - 1; i >= 0; i--) {
clk_disable_unprepare(qcom->clks[i]);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: dwc3: qcom: Release the correct resources in dwc3_qcom_remove()
2023-06-04 15:04 [PATCH] usb: dwc3: qcom: Release the correct resources in dwc3_qcom_remove() Christophe JAILLET
@ 2023-06-08 17:09 ` Andrew Halaney
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Halaney @ 2023-06-08 17:09 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Thinh Nguyen,
Greg Kroah-Hartman, Felipe Balbi, Lee Jones, linux-kernel,
kernel-janitors, linux-arm-msm, linux-usb
On Sun, Jun 04, 2023 at 05:04:37PM +0200, Christophe JAILLET wrote:
> In the probe, some resources are allocated with
> dwc3_qcom_of_register_core() or dwc3_qcom_acpi_register_core(). The
> corresponding resources are already coorectly freed in the error handling
nit not worthy of holding this up: s/coorectly/correctly/
> path of the probe, but not in the remove function.
>
> Fix it.
>
> Fixes: 2bc02355f8ba ("usb: dwc3: qcom: Add support for booting with ACPI")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Thanks,
Andrew
> ---
> drivers/usb/dwc3/dwc3-qcom.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index aa96c473f839..9c95f1d909ba 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -942,11 +942,15 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
> static void dwc3_qcom_remove(struct platform_device *pdev)
> {
> struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
> + struct device_node *np = pdev->dev.of_node;
> struct device *dev = &pdev->dev;
> int i;
>
> device_remove_software_node(&qcom->dwc3->dev);
> - of_platform_depopulate(dev);
> + if (np)
> + of_platform_depopulate(&pdev->dev);
> + else
> + platform_device_put(pdev);
>
> for (i = qcom->num_clocks - 1; i >= 0; i--) {
> clk_disable_unprepare(qcom->clks[i]);
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-08 17:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-04 15:04 [PATCH] usb: dwc3: qcom: Release the correct resources in dwc3_qcom_remove() Christophe JAILLET
2023-06-08 17:09 ` Andrew Halaney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).