Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa0ef93

Browse files
Yuuoniygregkh
authored andcommitted
usb: dwc3: dwc3-qcom: Add missing platform_device_put() in dwc3_qcom_acpi_register_core
Add the missing platform_device_put() before return from dwc3_qcom_acpi_register_core in the error handling case. Signed-off-by: Miaoqian Lin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 501e38a commit fa0ef93

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/usb/dwc3/dwc3-qcom.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,10 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
598598
qcom->dwc3->dev.coherent_dma_mask = dev->coherent_dma_mask;
599599

600600
child_res = kcalloc(2, sizeof(*child_res), GFP_KERNEL);
601-
if (!child_res)
601+
if (!child_res) {
602+
platform_device_put(qcom->dwc3);
602603
return -ENOMEM;
604+
}
603605

604606
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
605607
if (!res) {
@@ -637,9 +639,13 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
637639
if (ret) {
638640
dev_err(&pdev->dev, "failed to add device\n");
639641
device_remove_software_node(&qcom->dwc3->dev);
642+
goto out;
640643
}
644+
kfree(child_res);
645+
return 0;
641646

642647
out:
648+
platform_device_put(qcom->dwc3);
643649
kfree(child_res);
644650
return ret;
645651
}

0 commit comments

Comments
 (0)