diff mbox series

usbip: tools: update return status when failed

Message ID 20241022064856.4098350-1-min_halo@163.com (mailing list archive)
State Accepted
Commit e7cd4b811c9e019f5acbce85699c622b30194c24
Headers show
Series usbip: tools: update return status when failed | expand

Commit Message

Zongmin Zhou Oct. 22, 2024, 6:48 a.m. UTC
From: Zongmin Zhou <zhouzongmin@kylinos.cn>

Have to set "ret" before return when found a invalid port.

Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>
---
 tools/usb/usbip/src/usbip_detach.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Hongren Zheng Oct. 22, 2024, 7:58 a.m. UTC | #1
On Tue, Oct 22, 2024 at 02:48:56PM +0800, Zongmin Zhou wrote:
> From: Zongmin Zhou <zhouzongmin@kylinos.cn>
> 
> Have to set "ret" before return when found a invalid port.
> 
> Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>

Reviewed-by: Hongren Zheng <i@zenithal.me>

> ---
>  tools/usb/usbip/src/usbip_detach.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
> index b29101986b5a..6b78d4a81e95 100644
> --- a/tools/usb/usbip/src/usbip_detach.c
> +++ b/tools/usb/usbip/src/usbip_detach.c
> @@ -68,6 +68,7 @@ static int detach_port(char *port)
>  	}
>  
>  	if (!found) {
> +		ret = -1;
>  		err("Invalid port %s > maxports %d",
>  			port, vhci_driver->nports);
>  		goto call_driver_close;
> -- 
> 2.34.1
>
Shuah Khan Oct. 23, 2024, 6:59 p.m. UTC | #2
On 10/22/24 00:48, Zongmin Zhou wrote:
> From: Zongmin Zhou <zhouzongmin@kylinos.cn>

Update the short log to clearly indicate that this
is a fix:

usbip: tools: Fix detach_port() invalid port error path

> 
> Have to set "ret" before return when found a invalid port.

Give more details that detach_port() doesn't return error
when detach is attempted on an invalid port.

This is a fix for 40ecdeb1a1875
usbip: usbip_detach: fix to check for invalid ports

Add Fixes tag

This patch can be tagged for stable.

> 
> Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>
> ---
>   tools/usb/usbip/src/usbip_detach.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
> index b29101986b5a..6b78d4a81e95 100644
> --- a/tools/usb/usbip/src/usbip_detach.c
> +++ b/tools/usb/usbip/src/usbip_detach.c
> @@ -68,6 +68,7 @@ static int detach_port(char *port)
>   	}
>   
>   	if (!found) {
> +		ret = -1;
>   		err("Invalid port %s > maxports %d",
>   			port, vhci_driver->nports);
>   		goto call_driver_close;

With these changes:

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

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
index b29101986b5a..6b78d4a81e95 100644
--- a/tools/usb/usbip/src/usbip_detach.c
+++ b/tools/usb/usbip/src/usbip_detach.c
@@ -68,6 +68,7 @@  static int detach_port(char *port)
 	}
 
 	if (!found) {
+		ret = -1;
 		err("Invalid port %s > maxports %d",
 			port, vhci_driver->nports);
 		goto call_driver_close;