[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220105065517.6967-1-linmq006@gmail.com>
Date: Wed, 5 Jan 2022 06:55:17 +0000
From: Miaoqian Lin <linmq006@...il.com>
To: vladimir.zapolskiy@...aro.org
Cc: agross@...nel.org, balbi@...nel.org, bjorn.andersson@...aro.org,
gregkh@...uxfoundation.org, linmq006@...il.com,
linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org
Subject: [PATCH v2] usb: dwc3: dwc3-qcom: Add missing platform_device_put() in dwc3_qcom_acpi_register_core
Fix the missing platform_device_put() before return from
dwc3_qcom_acpi_register_core in the error handling case.
Fixes: 2bc02355f8ba ("usb: dwc3: qcom: Add support for booting with ACPI")
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
Changes in v2:
- add fixes tag.
- do error handling in a unified way.
- add necessary blank line.
---
drivers/usb/dwc3/dwc3-qcom.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 3cb01cdd02c2..f7f4af4c4ce5 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -598,8 +598,10 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
qcom->dwc3->dev.coherent_dma_mask = dev->coherent_dma_mask;
child_res = kcalloc(2, sizeof(*child_res), GFP_KERNEL);
- if (!child_res)
- return -ENOMEM;
+ if (!child_res) {
+ ret = -ENOMEM;
+ goto out;
+ }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
@@ -637,9 +639,14 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev, "failed to add device\n");
device_remove_software_node(&qcom->dwc3->dev);
+ goto out;
}
+ kfree(child_res);
+ return 0;
+
out:
+ platform_device_put(qcom->dwc3);
kfree(child_res);
return ret;
}
--
2.17.1
Powered by blists - more mailing lists