# RE: \[PATCH\] drivers: hv: Fix missing error code in vmbus\_connect()

- From: Michael Kelley \<hidden\>
- Date: 2021-05-25 15:30:27 
- List: linux-hyperv
- Page: https://ratatoskr.run/linux-hyperv/2021/05/1391549
- Thread: https://ratatoskr.run/linux-hyperv/2021/05/1391164/t.md

```text
From: Jiapeng Chong <redacted> Sent: Tuesday, May 25, 2021 3:59 AM
> 
> Eliminate the follow smatch warning:
> 
> drivers/hv/connection.c:236 vmbus_connect() warn: missing error code
> 'ret'.
> 
> Reported-by: Abaci Robot <redacted>
> Signed-off-by: Jiapeng Chong <redacted>
> ---
>  drivers/hv/connection.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
> index 311cd00..5e479d5 100644
> --- a/drivers/hv/connection.c
> +++ b/drivers/hv/connection.c
> @@ -232,8 +232,10 @@ int vmbus_connect(void)
>  	 */
> 
>  	for (i = 0; ; i++) {
> -		if (i == ARRAY_SIZE(vmbus_versions))
> +		if (i == ARRAY_SIZE(vmbus_versions)) {
> +			ret = -EDOM;
>  			goto cleanup;
> +		}
> 
>  		version = vmbus_versions[i];
>  		if (version > max_version)
> --
> 1.8.3.1

I might have used -EINVAL instead of -EDOM as the error
return value, but it really doesn't matter, and having a 
return value that is unique in the function might be helpful.

Reviewed-by: Michael Kelley <redacted>


```
