staging: vchiq_core: Return on all errors from queue_message()
authorUmang Jain <umang.jain@ideasonboard.com>
Wed, 18 Sep 2024 16:30:56 +0000 (22:00 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Oct 2024 09:58:47 +0000 (11:58 +0200)
In vchiq_connect_internal(), a MAKE_CONNECT message is queued
if the connection is disconnected, but only -EAGAIN error is
checked on the error path and returned.

However, queue_message() can fail with other errors as well hence,
vchiq_connect_internal() should return in those cases as well.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Link: https://lore.kernel.org/r/20240918163100.870596-3-umang.jain@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c

index a381a633d3d56bb1f67a9398efe9b542f3cc31f1..4279dd182a980da73998c6a13a61c2a8e77c6826 100644 (file)
@@ -2945,6 +2945,7 @@ int
 vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instance)
 {
        struct vchiq_service *service;
+       int status = 0;
        int i;
 
        /* Find all services registered to this client and enable them. */
@@ -2956,9 +2957,10 @@ vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instanc
        }
 
        if (state->conn_state == VCHIQ_CONNSTATE_DISCONNECTED) {
-               if (queue_message(state, NULL, MAKE_CONNECT, NULL, NULL, 0,
-                                 QMFLAGS_IS_BLOCKING) == -EAGAIN)
-                       return -EAGAIN;
+               status = queue_message(state, NULL, MAKE_CONNECT, NULL, NULL, 0,
+                                      QMFLAGS_IS_BLOCKING);
+               if (status)
+                       return status;
 
                vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTING);
        }
@@ -2971,7 +2973,7 @@ vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instanc
                complete(&state->connect);
        }
 
-       return 0;
+       return status;
 }
 
 void