Skip to content

Commit 9feefbf

Browse files
jhovoldgregkh
authored andcommitted
USB: dwc3: qcom: fix software node leak on probe errors
Make sure to remove the software node also on (ACPI) probe errors to avoid leaking the underlying resources. Note that the software node is only used for ACPI probe so the driver unbind tear down is updated to match probe. Fixes: 8dc6e6d ("usb: dwc3: qcom: Constify the software node") Cc: [email protected] # 5.12 Cc: Heikki Krogerus <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Acked-by: Heikki Krogerus <[email protected]> Acked-by: Andrew Halaney <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 51392a1 commit 9feefbf

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/usb/dwc3/dwc3-qcom.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -928,10 +928,12 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
928928
interconnect_exit:
929929
dwc3_qcom_interconnect_exit(qcom);
930930
depopulate:
931-
if (np)
931+
if (np) {
932932
of_platform_depopulate(&pdev->dev);
933-
else
933+
} else {
934+
device_remove_software_node(&qcom->dwc3->dev);
934935
platform_device_del(qcom->dwc3);
936+
}
935937
platform_device_put(qcom->dwc3);
936938
clk_disable:
937939
for (i = qcom->num_clocks - 1; i >= 0; i--) {
@@ -951,11 +953,12 @@ static void dwc3_qcom_remove(struct platform_device *pdev)
951953
struct device *dev = &pdev->dev;
952954
int i;
953955

954-
device_remove_software_node(&qcom->dwc3->dev);
955-
if (np)
956+
if (np) {
956957
of_platform_depopulate(&pdev->dev);
957-
else
958+
} else {
959+
device_remove_software_node(&qcom->dwc3->dev);
958960
platform_device_del(qcom->dwc3);
961+
}
959962
platform_device_put(qcom->dwc3);
960963

961964
for (i = qcom->num_clocks - 1; i >= 0; i--) {

0 commit comments

Comments
 (0)