diff mbox series

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

Message ID 20200506135625.106910-1-weiyongjun1@huawei.com (mailing list archive)
State Mainlined
Commit b919e077cccfbb77beb98809568b2fb0b4d113ec
Headers show
Series [-next] USB: ohci-sm501: fix error return code in ohci_hcd_sm501_drv_probe() | expand

Commit Message

Wei Yongjun May 6, 2020, 1:56 p.m. UTC
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")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/usb/host/ohci-sm501.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Alan Stern May 6, 2020, 2:12 p.m. UTC | #1
On Wed, 6 May 2020, Wei Yongjun wrote:

> 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")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/usb/host/ohci-sm501.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
> index c158cda9e4b9..cff965240327 100644
> --- a/drivers/usb/host/ohci-sm501.c
> +++ b/drivers/usb/host/ohci-sm501.c
> @@ -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)

Acked-by: Alan Stern <stern@rowland.harvard.edu>

Thanks for noticing and fixing this.

Alan Stern
Walter Harms May 6, 2020, 2:53 p.m. UTC | #2
while you are here ...
maybe you can give labels like err5 some meaningful names ?

re,
 wh
diff mbox series

Patch

diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index c158cda9e4b9..cff965240327 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -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)