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.

Signed-off-by: Aswin Venkatesan <[email protected]>
Signed-off-by: Youssef Samir <[email protected]>
---
 drivers/accel/qaic/qaic_control.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/accel/qaic/qaic_control.c 
b/drivers/accel/qaic/qaic_control.c
index d8bdab69f800..b71aa2894001 100644
--- a/drivers/accel/qaic/qaic_control.c
+++ b/drivers/accel/qaic/qaic_control.c
@@ -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)
-- 
2.43.0

Reply via email to