Commit fbd06c75 authored by Umang Jain's avatar Umang Jain Committed by Greg Kroah-Hartman
Browse files

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: default avatarUmang Jain <umang.jain@ideasonboard.com>
Link: https://lore.kernel.org/r/20240918163100.870596-3-umang.jain@ideasonboard.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 36022f3e
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -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