Skip to contentSkip to conversation

accel/qaic: Fix incorrect error return path

PATCH Applied Youssef Samir 3 participants 4 messages Oct 7, 2025 – Oct 14, 2025

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

PATCH 1/1 accel/qaic: Fix incorrect error return path

From: Aswin Venkatesan <[email protected]>

Found via code inspection that when encode_message() fails in the middle of processing, instead of returning the actual error code, it always returns -EINVAL. This is because the entire message length has not been processed, and the error code is set to -EINVAL.
Instead, take the 'out' path on failure to return the actual error code.

---
 drivers/accel/qaic/qaic_control.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/qaic/qaic_control.c +1 -1
index d8bdab69f800..b71aa2894001 100644
@@ -810,7 +810,7 @@ static int encode_message(struct qaic_device *qdev, struct manage_msg *user_msg,
 		}
 
 		if (ret)
-			break;
+			goto out;
 	}
 
 	if (user_len != user_msg->len)
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Youssef Samir

From: Aswin Venkatesan <[email protected]>

Found via code inspection that when encode_message() fails in the middle of processing, instead of returning the actual error code, it always returns -EINVAL. This is because the entire message length has not been processed, and the error code is set to -EINVAL.
Instead, take the 'out' path on failure to return the actual error code.

reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Youssef Samir
Quoted 11 lines · Youssef Samir

From: Aswin Venkatesan <[email protected]>

Found via code inspection that when encode_message() fails in the middle of processing, instead of returning the actual error code, it always returns -EINVAL. This is because the entire message length has not been processed, and the error code is set to -EINVAL.
Instead, take the 'out' path on failure to return the actual error code.

---

maintainer Applied
#3 lore raw
In reply to Youssef Samir
Quoted 10 lines · Youssef Samir

From: Aswin Venkatesan <[email protected]>

Found via code inspection that when encode_message() fails in the middle of processing, instead of returning the actual error code, it always returns -EINVAL. This is because the entire message length has not been processed, and the error code is set to -EINVAL.
Instead, take the 'out' path on failure to return the actual error code.

Pushed to drm-misc-next.

-Jeff