Skip to contentSkip to conversation

USB: ohci-sm501: fix error return code in ohci_hcd_sm501_drv_probe()

PATCH In review Wei Yongjun 3 participants 3 messages May 6, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB: ohci-sm501: fix error return code in ohci_hcd_sm501_drv_probe()

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 7d9e6f5aebe8 ("usb: host: ohci-sm501: init genalloc for local memory")
---
 drivers/usb/host/ohci-sm501.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-sm501.c +4 -3
index c158cda9e4b9..cff965240327 100644
@@ -157,9 +157,10 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev)
 	 * the call to usb_hcd_setup_local_mem() below does just that.
 	 */
 
-	if (usb_hcd_setup_local_mem(hcd, mem->start,
-				    mem->start - mem->parent->start,
-				    resource_size(mem)) < 0)
+	retval = usb_hcd_setup_local_mem(hcd, mem->start,
+					 mem->start - mem->parent->start,
+					 resource_size(mem));
+	if (retval < 0)
 		goto err5;
 	retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
 	if (retval)
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Wei Yongjun

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 7d9e6f5aebe8 ("usb: host: ohci-sm501: init genalloc for local memory")
---
 drivers/usb/host/ohci-sm501.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-sm501.c +0 -0
index c158cda9e4b9..cff965240327 100644
@@ -157,9 +157,10 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev)
 	 * the call to usb_hcd_setup_local_mem() below does just that.
 	 */
 

drivers/usb/host/ohci-sm501.c static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev) · line 166

Quoted 10 lines
drivers/usb/host/ohci-sm501.c +4 -3
-	if (usb_hcd_setup_local_mem(hcd, mem->start,
-				    mem->start - mem->parent->start,
-				    resource_size(mem)) < 0)
+	retval = usb_hcd_setup_local_mem(hcd, mem->start,
+					 mem->start - mem->parent->start,
+					 resource_size(mem));
+	if (retval < 0)
 		goto err5;
 	retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
 	if (retval)

Thanks for noticing and fixing this.

Alan Stern

Acked-by Alan Stern
#2 lore raw

while you are here ...
maybe you can give labels like err5 some meaningful names ?

re,
wh
________________________________________
Von: [email protected] <[email protected]> im Auftrag von Alan Stern <[email protected]>
Gesendet: Mittwoch, 6. Mai 2020 16:12:08
An: Wei Yongjun
Cc: Greg Kroah-Hartman; Laurentiu Tudor; [email protected]; [email protected]
Betreff: Re: [PATCH -next] USB: ohci-sm501: fix error return code in ohci_hcd_sm501_drv_probe()

Quoted 17 lines · Wei Yongjun

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 7d9e6f5aebe8 ("usb: host: ohci-sm501: init genalloc for local memory")
---
 drivers/usb/host/ohci-sm501.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-sm501.c +0 -0
index c158cda9e4b9..cff965240327 100644
@@ -157,9 +157,10 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev)
       * the call to usb_hcd_setup_local_mem() below does just that.
       */
 

drivers/usb/host/ohci-sm501.c static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev) · line 166

Quoted 10 lines
drivers/usb/host/ohci-sm501.c +4 -3
-     if (usb_hcd_setup_local_mem(hcd, mem->start,
-                                 mem->start - mem->parent->start,
-                                 resource_size(mem)) < 0)
+     retval = usb_hcd_setup_local_mem(hcd, mem->start,
+                                      mem->start - mem->parent->start,
+                                      resource_size(mem));
+     if (retval < 0)
              goto err5;
      retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
      if (retval)

Thanks for noticing and fixing this.

Alan Stern