All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: hv: Fix missing error code in vmbus_connect()
@ 2021-05-25 10:58 Jiapeng Chong
  2021-05-25 15:30 ` Michael Kelley
  0 siblings, 1 reply; 3+ messages in thread
From: Jiapeng Chong @ 2021-05-25 10:58 UTC (permalink / raw)
  To: kys
  Cc: haiyangz, sthemmin, wei.liu, decui, linux-hyperv, linux-kernel,
	Jiapeng Chong

Eliminate the follow smatch warning:

drivers/hv/connection.c:236 vmbus_connect() warn: missing error code
'ret'.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] drivers: hv: Fix missing error code in vmbus_connect()
  2021-05-25 10:58 [PATCH] drivers: hv: Fix missing error code in vmbus_connect() Jiapeng Chong
@ 2021-05-25 15:30 ` Michael Kelley
  2021-05-26 10:07   ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Kelley @ 2021-05-25 15:30 UTC (permalink / raw)
  To: Jiapeng Chong, KY Srinivasan
  Cc: Haiyang Zhang, Stephen Hemminger, wei.liu, Dexuan Cui,
	linux-hyperv, linux-kernel

From: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> 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 <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  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 <mikelley@microsoft.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drivers: hv: Fix missing error code in vmbus_connect()
  2021-05-25 15:30 ` Michael Kelley
@ 2021-05-26 10:07   ` Wei Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Liu @ 2021-05-26 10:07 UTC (permalink / raw)
  To: Michael Kelley
  Cc: Jiapeng Chong, KY Srinivasan, Haiyang Zhang, Stephen Hemminger,
	wei.liu, Dexuan Cui, linux-hyperv, linux-kernel

On Tue, May 25, 2021 at 03:30:22PM +0000, Michael Kelley wrote:
> From: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> 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 <abaci@linux.alibaba.com>
> > Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> > ---
> >  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 <mikelley@microsoft.com>

Applied to hyperv-fixes. Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-26 10:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 10:58 [PATCH] drivers: hv: Fix missing error code in vmbus_connect() Jiapeng Chong
2021-05-25 15:30 ` Michael Kelley
2021-05-26 10:07   ` Wei Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.