Skip to contentSkip to conversation

drivers: hv: Fix missing error code in vmbus_connect()

PATCH Applied Jiapeng Chong 3 participants 3 messages May 25, 2021 – May 26, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: hv: Fix missing error code in vmbus_connect()

Eliminate the follow smatch warning:

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

---
 drivers/hv/connection.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hv/connection.c +3 -1
index 311cd00..5e479d5 100644
@@ -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)
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw

From: Jiapeng Chong <[email protected]> Sent: Tuesday, May 25, 2021 3:59 AM

Quoted 29 lines

Eliminate the follow smatch warning:

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

---
 drivers/hv/connection.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hv/connection.c +3 -2
index 311cd00..5e479d5 100644
@@ -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)
--
Quoted 1 line

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.

maintainer Applied
#2 lore raw
Quoted 36 lines · Michael Kelley

From: Jiapeng Chong <[email protected]> Sent: Tuesday, May 25, 2021 3:59 AM

Quoted 29 lines

Eliminate the follow smatch warning:

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

---
 drivers/hv/connection.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hv/connection.c +3 -2
index 311cd00..5e479d5 100644
@@ -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)
--
Quoted 1 line

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.

Quoted 1 line

Applied to hyperv-fixes. Thanks.