diff mbox series

[-next] USB: usbip: Remove an unnecessary goto

Message ID 20230805045631.1858638-1-ruanjinjie@huawei.com
State New
Headers show
Series [-next] USB: usbip: Remove an unnecessary goto | expand

Commit Message

Jinjie Ruan Aug. 5, 2023, 4:56 a.m. UTC
When udc_dev = NULL, it is not necessary to goto out to return, just
return NULL directly. And the out goto label can be removed.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
---
 drivers/usb/usbip/vudc_dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Shuah Aug. 7, 2023, 7:44 p.m. UTC | #1
On 8/4/23 22:56, Ruan Jinjie wrote:
> When udc_dev = NULL, it is not necessary to goto out to return, just
> return NULL directly. And the out goto label can be removed.
> 
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> ---
>   drivers/usb/usbip/vudc_dev.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c
> index 2bc428f2e261..bed21b83de68 100644
> --- a/drivers/usb/usbip/vudc_dev.c
> +++ b/drivers/usb/usbip/vudc_dev.c
> @@ -493,7 +493,7 @@ struct vudc_device *alloc_vudc_device(int devid)
>   
>   	udc_dev = kzalloc(sizeof(*udc_dev), GFP_KERNEL);
>   	if (!udc_dev)
> -		goto out;
> +		return NULL;
>   
>   	INIT_LIST_HEAD(&udc_dev->dev_entry);
>   
> @@ -503,7 +503,6 @@ struct vudc_device *alloc_vudc_device(int devid)
>   		udc_dev = NULL;
>   	}
>   
> -out:
>   	return udc_dev;
>   }
>   

Looks good to me.

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

Greg, Please pick this up.

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c
index 2bc428f2e261..bed21b83de68 100644
--- a/drivers/usb/usbip/vudc_dev.c
+++ b/drivers/usb/usbip/vudc_dev.c
@@ -493,7 +493,7 @@  struct vudc_device *alloc_vudc_device(int devid)
 
 	udc_dev = kzalloc(sizeof(*udc_dev), GFP_KERNEL);
 	if (!udc_dev)
-		goto out;
+		return NULL;
 
 	INIT_LIST_HEAD(&udc_dev->dev_entry);
 
@@ -503,7 +503,6 @@  struct vudc_device *alloc_vudc_device(int devid)
 		udc_dev = NULL;
 	}
 
-out:
 	return udc_dev;
 }