diff mbox series

usb: dwc3: qcom: Fix NULL vs IS_ERR checking in dwc3_qcom_probe

Message ID 20211222091444.5034-1-linmq006@gmail.com
State New
Headers show
Series usb: dwc3: qcom: Fix NULL vs IS_ERR checking in dwc3_qcom_probe | expand

Commit Message

Miaoqian Lin Dec. 22, 2021, 9:14 a.m. UTC
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 mbox series

Patch

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;
 			}
 		}
 	}