staging: vchiq_core: Return on all errors from queue_message()

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>
This commit is contained in:
Umang Jain 2024-09-18 22:00:56 +05:30 committed by Greg Kroah-Hartman
parent 36022f3ee8
commit fbd06c751a

View 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