* [PATCH] usb: dwc3: dwc3-qcom: Add missing platform_device_put() in dwc3_qcom_acpi_register_core
@ 2021-12-31 11:36 Miaoqian Lin
2022-01-04 20:10 ` Vladimir Zapolskiy
0 siblings, 1 reply; 6+ messages in thread
From: Miaoqian Lin @ 2021-12-31 11:36 UTC (permalink / raw)
Cc: linmq006, Andy Gross, Bjorn Andersson, Felipe Balbi,
Greg Kroah-Hartman, linux-arm-msm, linux-usb, linux-kernel
Add the missing platform_device_put() before return from
dwc3_qcom_acpi_register_core in the error handling case.
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/usb/dwc3/dwc3-qcom.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 3cb01cdd02c2..5257783f17b0 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)
+ if (!child_res) {
+ platform_device_put(qcom->dwc3);
return -ENOMEM;
+ }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
@@ -637,9 +639,13 @@ 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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: dwc3: dwc3-qcom: Add missing platform_device_put() in dwc3_qcom_acpi_register_core
2021-12-31 11:36 [PATCH] usb: dwc3: dwc3-qcom: Add missing platform_device_put() in dwc3_qcom_acpi_register_core Miaoqian Lin
@ 2022-01-04 20:10 ` Vladimir Zapolskiy
2022-01-05 6:55 ` [PATCH v2] " Miaoqian Lin
0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Zapolskiy @ 2022-01-04 20:10 UTC (permalink / raw)
To: Miaoqian Lin
Cc: Andy Gross, Bjorn Andersson, Felipe Balbi, Greg Kroah-Hartman,
linux-arm-msm, linux-usb, linux-kernel
On 12/31/21 1:36 PM, Miaoqian Lin wrote:
> Add the missing platform_device_put() before return from
> dwc3_qcom_acpi_register_core in the error handling case.
>
The discovered issue is valid.
Fixes: 2bc02355f8ba ("usb: dwc3: qcom: Add support for booting with ACPI")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> drivers/usb/dwc3/dwc3-qcom.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 3cb01cdd02c2..5257783f17b0 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)
> + if (!child_res) {
> + platform_device_put(qcom->dwc3);
> return -ENOMEM;
Please do it in a unified way along all checks:
ret = -ENOMEM;
goto out;
kfree(NULL) is legit, please utilize it.
> + }
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (!res) {
> @@ -637,9 +639,13 @@ 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;
> }
Please add a blank line here after the closing curly bracket.
> + kfree(child_res);
> + return 0;
>
> out:
> + platform_device_put(qcom->dwc3);
> kfree(child_res);
> return ret;
> }
>
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
--
Best wishes,
Vladimir
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] usb: dwc3: dwc3-qcom: Add missing platform_device_put() in dwc3_qcom_acpi_register_core
2022-01-04 20:10 ` Vladimir Zapolskiy
@ 2022-01-05 6:55 ` Miaoqian Lin
2022-01-06 14:26 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: Miaoqian Lin @ 2022-01-05 6:55 UTC (permalink / raw)
To: vladimir.zapolskiy
Cc: agross, balbi, bjorn.andersson, gregkh, linmq006, linux-arm-msm,
linux-kernel, linux-usb
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@gmail.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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] usb: dwc3: dwc3-qcom: Add missing platform_device_put() in dwc3_qcom_acpi_register_core
2022-01-05 6:55 ` [PATCH v2] " Miaoqian Lin
@ 2022-01-06 14:26 ` Greg KH
2022-01-07 3:07 ` Miaoqian Lin
0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2022-01-06 14:26 UTC (permalink / raw)
To: Miaoqian Lin
Cc: vladimir.zapolskiy, agross, balbi, bjorn.andersson,
linux-arm-msm, linux-kernel, linux-usb
On Wed, Jan 05, 2022 at 06:55:17AM +0000, Miaoqian Lin wrote:
> 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@gmail.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(-)
Does not apply to my tree at all :(
Please rebase and resend.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] usb: dwc3: dwc3-qcom: Add missing platform_device_put() in dwc3_qcom_acpi_register_core
2022-01-06 14:26 ` Greg KH
@ 2022-01-07 3:07 ` Miaoqian Lin
2022-01-07 9:04 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: Miaoqian Lin @ 2022-01-07 3:07 UTC (permalink / raw)
To: Greg KH
Cc: vladimir.zapolskiy, agross, balbi, bjorn.andersson,
linux-arm-msm, linux-kernel, linux-usb
Hi greg k-h:
> > Fixes: 2bc02355f8ba ("usb: dwc3: qcom: Add support for booting with ACPI")
> > Signed-off-by: Miaoqian Lin <linmq006@gmail.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(-)
>
>
> Does not apply to my tree at all :(
>
> Please rebase and resend.
I see the v1 of this patch has been applied to usb-next branch.
v2 has some format fixes. I am unsure should I rebase v2 on the top of usb-next?
I am afraid to introduce more inconvenience.
Regards,
Miaoqian.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] usb: dwc3: dwc3-qcom: Add missing platform_device_put() in dwc3_qcom_acpi_register_core
2022-01-07 3:07 ` Miaoqian Lin
@ 2022-01-07 9:04 ` Greg KH
0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2022-01-07 9:04 UTC (permalink / raw)
To: Miaoqian Lin
Cc: vladimir.zapolskiy, agross, balbi, bjorn.andersson,
linux-arm-msm, linux-kernel, linux-usb
On Fri, Jan 07, 2022 at 11:07:19AM +0800, Miaoqian Lin wrote:
> Hi greg k-h:
> > > Fixes: 2bc02355f8ba ("usb: dwc3: qcom: Add support for booting with ACPI")
> > > Signed-off-by: Miaoqian Lin <linmq006@gmail.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(-)
> >
> >
> > Does not apply to my tree at all :(
> >
> > Please rebase and resend.
>
> I see the v1 of this patch has been applied to usb-next branch.
> v2 has some format fixes. I am unsure should I rebase v2 on the top of usb-next?
> I am afraid to introduce more inconvenience.
If v1 was incorrect, please submit a patch to either fix it, or revert
it entirely.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-01-07 9:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-31 11:36 [PATCH] usb: dwc3: dwc3-qcom: Add missing platform_device_put() in dwc3_qcom_acpi_register_core Miaoqian Lin
2022-01-04 20:10 ` Vladimir Zapolskiy
2022-01-05 6:55 ` [PATCH v2] " Miaoqian Lin
2022-01-06 14:26 ` Greg KH
2022-01-07 3:07 ` Miaoqian Lin
2022-01-07 9:04 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.