* [PATCH] usb: dwc3: qcom: Fix NULL vs IS_ERR checking in dwc3_qcom_probe
@ 2021-12-22 9:14 Miaoqian Lin
2021-12-22 9:31 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Miaoqian Lin @ 2021-12-22 9:14 UTC (permalink / raw)
Cc: linmq006, Andy Gross, Bjorn Andersson, Felipe Balbi,
Greg Kroah-Hartman, Shawn Guo, linux-arm-msm, linux-usb,
linux-kernel
Since the acpi_create_platform_device() function may return error
pointers, dwc3_qcom_create_urs_usb_platdev() function may return errors
too. Using IS_ERR_OR_NULL() to check the return value to fix this.
Fixes: c25c210f590e("usb: dwc3: qcom: add URS Host support for sdm845 ACPI boot")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/usb/dwc3/dwc3-qcom.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 3cb01cdd02c2..df27d903ba98 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -769,9 +769,9 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
if (qcom->acpi_pdata->is_urs) {
qcom->urs_usb = dwc3_qcom_create_urs_usb_platdev(dev);
- if (!qcom->urs_usb) {
+ if (IS_ERR_OR_NULL(qcom->urs_usb)) {
dev_err(dev, "failed to create URS USB platdev\n");
- return -ENODEV;
+ return qcom->urs_usb ? PTR_ERR(qcom->urs_usb) : -ENODEV;
}
}
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: dwc3: qcom: Fix NULL vs IS_ERR checking in dwc3_qcom_probe
2021-12-22 9:14 [PATCH] usb: dwc3: qcom: Fix NULL vs IS_ERR checking in dwc3_qcom_probe Miaoqian Lin
@ 2021-12-22 9:31 ` Greg Kroah-Hartman
2021-12-22 10:47 ` [PATCH v2] " Miaoqian Lin
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2021-12-22 9:31 UTC (permalink / raw)
To: Miaoqian Lin
Cc: linmq006, Andy Gross, Bjorn Andersson, Felipe Balbi,
Greg Kroah-Hartman, Shawn Guo, linux-arm-msm, linux-usb,
linux-kernel
[note, you got the to: line incorrect...]
On Wed, Dec 22, 2021 at 09:14:44AM +0000, Miaoqian Lin wrote:
> Since the acpi_create_platform_device() function may return error
> pointers, dwc3_qcom_create_urs_usb_platdev() function may return errors
> too. Using IS_ERR_OR_NULL() to check the return value to fix this.
>
> Fixes: c25c210f590e("usb: dwc3: qcom: add URS Host support for sdm845 ACPI boot")
Nit, the documentation says this should be:
Fixes: c25c210f590e ("usb: dwc3: qcom: add URS Host support for sdm845 ACPI boot")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> drivers/usb/dwc3/dwc3-qcom.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 3cb01cdd02c2..df27d903ba98 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -769,9 +769,9 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
>
> if (qcom->acpi_pdata->is_urs) {
> qcom->urs_usb = dwc3_qcom_create_urs_usb_platdev(dev);
> - if (!qcom->urs_usb) {
> + if (IS_ERR_OR_NULL(qcom->urs_usb)) {
> dev_err(dev, "failed to create URS USB platdev\n");
> - return -ENODEV;
> + return qcom->urs_usb ? PTR_ERR(qcom->urs_usb) : -ENODEV;
Please no ? : if at all possible. Spell it out as a real if statement.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] usb: dwc3: qcom: Fix NULL vs IS_ERR checking in dwc3_qcom_probe
2021-12-22 9:31 ` Greg Kroah-Hartman
@ 2021-12-22 10:47 ` Miaoqian Lin
0 siblings, 0 replies; 3+ messages in thread
From: Miaoqian Lin @ 2021-12-22 10:47 UTC (permalink / raw)
Cc: linmq006, Andy Gross, Bjorn Andersson, Felipe Balbi,
Greg Kroah-Hartman, Shawn Guo, linux-arm-msm, linux-usb,
linux-kernel
Since the acpi_create_platform_device() function may return error
pointers, dwc3_qcom_create_urs_usb_platdev() function may return error
pointers too. Using IS_ERR_OR_NULL() to check the return value to fix this.
Fixes: c25c210f590e ("usb: dwc3: qcom: add URS Host support for sdm845 ACPI boot")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/usb/dwc3/dwc3-qcom.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 3cb01cdd02c2..b81a9e1c1315 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -769,9 +769,12 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
if (qcom->acpi_pdata->is_urs) {
qcom->urs_usb = dwc3_qcom_create_urs_usb_platdev(dev);
- if (!qcom->urs_usb) {
+ if (IS_ERR_OR_NULL(qcom->urs_usb)) {
dev_err(dev, "failed to create URS USB platdev\n");
- return -ENODEV;
+ if (!qcom->urs_usb)
+ return -ENODEV;
+ else
+ return PTR_ERR(qcom->urs_usb);
}
}
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-22 10:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22 9:14 [PATCH] usb: dwc3: qcom: Fix NULL vs IS_ERR checking in dwc3_qcom_probe Miaoqian Lin
2021-12-22 9:31 ` Greg Kroah-Hartman
2021-12-22 10:47 ` [PATCH v2] " Miaoqian Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).