Skip to contentSkip to conversation

usb: dwc3: qcom: Fixed an issue that the ret value is incorrect in dwc3_qcom_probe()

PATCH In review Bixuan Cui 2 participants 3 messages Apr 9, 2021 – Apr 10, 2021

Subsystems (3)
lore
Share & tools
lore

Bixuan Cui

author
#0 lore raw

PATCH 1/1 usb: dwc3: qcom: Fixed an issue that the ret value is incorrect in dwc3_qcom_probe()

There is a error message after devm_ioremap_resource failed, and the ret is needs to be obtained through PTR_ERR(qcom->qscratch_base). We need to move the dev_err() downwards to ensure that the ret value is correct.

Fixes a4333c3a6ba9 ('usb: dwc3: Add Qualcomm DWC3 glue driver')
---
 drivers/usb/dwc3/dwc3-qcom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-qcom.c +1 -1
index e37cc58dfa55..4716ca8c753d 100644
@@ -774,8 +774,8 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
 
 	qcom->qscratch_base = devm_ioremap_resource(dev, parent_res);
 	if (IS_ERR(qcom->qscratch_base)) {
-		dev_err(dev, "failed to map qscratch, err=%d\n", ret);
 		ret = PTR_ERR(qcom->qscratch_base);
+		dev_err(dev, "failed to map qscratch, err=%d\n", ret);
 		goto clk_disable;
 	}
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 17 lines · Bixuan Cui

There is a error message after devm_ioremap_resource failed, and the ret is needs to be obtained through PTR_ERR(qcom->qscratch_base). We need to move the dev_err() downwards to ensure that the ret value is correct.

Fixes a4333c3a6ba9 ('usb: dwc3: Add Qualcomm DWC3 glue driver')
---
 drivers/usb/dwc3/dwc3-qcom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-qcom.c +0 -0
index e37cc58dfa55..4716ca8c753d 100644

drivers/usb/dwc3/dwc3-qcom.c static int dwc3_qcom_probe(struct platform_device *pdev) · line 778

Quoted 6 lines
drivers/usb/dwc3/dwc3-qcom.c +1 -1
@@ -774,8 +774,8 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
 
 	qcom->qscratch_base = devm_ioremap_resource(dev, parent_res);
 	if (IS_ERR(qcom->qscratch_base)) {
-		dev_err(dev, "failed to map qscratch, err=%d\n", ret);
 		ret = PTR_ERR(qcom->qscratch_base);
+		dev_err(dev, "failed to map qscratch, err=%d\n", ret);

But this error message can be removed altogether as devm_ioremap_resource() reports it already.

Thanks,
Mani

Quoted 6 lines
drivers/usb/dwc3/dwc3-qcom.c +0 -0
 		goto clk_disable;
 	}
 
Signature · 1 line
2.17.1
author
#2 lore raw
Quoted 2 lines · Manivannan Sadhasivam

But this error message can be removed altogether as devm_ioremap_resource() reports it already.

Thank you for your reply. I'll revise it.

Thanks,
Bixuan Cui