Re: [PATCH 07/12] usb: dwc3: qcom: Instantiate dwc3 core directly

Krishna Kurapati PSSNV
2024-01-10T03:17:07Z

On 10/17/2023 8:41 AM, Bjorn Andersson wrote:
> The Qualcomm DWC3 glue builds up a platform_device programmatically in
> order to probe the DWC3 core when running off ACPI data. But with the
> newly introduced support for instantiating the core directly from the
> glue, this code can be replaced with a single function call.
>

> @@ -942,7 +889,7 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
> if (np)
> ret = dwc3_qcom_of_register_core(pdev);
> else
> - ret = dwc3_qcom_acpi_register_core(pdev);
> + ret = dwc3_qcom_probe_core(pdev, qcom);
>
> if (ret) {
> dev_err(dev, "failed to register DWC3 Core, err=%d\n", ret);
> @@ -986,10 +933,10 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
> interconnect_exit:
> dwc3_qcom_interconnect_exit(qcom);
> depopulate:
> - if (np)
> + if (qcom->dwc_dev)
> of_platform_depopulate(&pdev->dev);
> else
> - platform_device_put(pdev);
> + dwc3_remove(qcom->dwc);

Hi Bjorn

I was testing this patch and I suspect there is one issue.

In the event dwc3_qcom_probe_core fails because dwc3_probe failed,
then the variable (qcom->dwc) is NULL. We then exercise the depopulate
path and we call dwc_remove(NULL) causing a crash.

Regards,
Krishna,