mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 07:04:24 +00:00
staging: vchiq_core: break early in vchiq_close_service_internal
The logic in VCHIQ_SRVSTATE_OPEN* is unnecessary complex. Handle the error case of queue_message() first makes it easier to read. Btw we get the rid of the checkpatch warning: WARNING: else is not generally useful after a break or return Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1619347863-16080-3-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
bdf2b26de6
commit
bd18b980a2
1 changed files with 13 additions and 13 deletions
|
@ -2763,21 +2763,21 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd)
|
|||
VCHIQ_MSG_DSTPORT(service->remoteport)),
|
||||
NULL, NULL, 0, QMFLAGS_NO_MUTEX_UNLOCK);
|
||||
|
||||
if (status == VCHIQ_SUCCESS) {
|
||||
if (!close_recvd) {
|
||||
/* Change the state while the mutex is still held */
|
||||
vchiq_set_service_state(service,
|
||||
VCHIQ_SRVSTATE_CLOSESENT);
|
||||
mutex_unlock(&state->slot_mutex);
|
||||
if (service->sync)
|
||||
mutex_unlock(&state->sync_mutex);
|
||||
break;
|
||||
}
|
||||
} else if (service->srvstate == VCHIQ_SRVSTATE_OPENSYNC) {
|
||||
mutex_unlock(&state->sync_mutex);
|
||||
if (status != VCHIQ_SUCCESS) {
|
||||
if (service->srvstate == VCHIQ_SRVSTATE_OPENSYNC)
|
||||
mutex_unlock(&state->sync_mutex);
|
||||
break;
|
||||
} else
|
||||
}
|
||||
|
||||
if (!close_recvd) {
|
||||
/* Change the state while the mutex is still held */
|
||||
vchiq_set_service_state(service,
|
||||
VCHIQ_SRVSTATE_CLOSESENT);
|
||||
mutex_unlock(&state->slot_mutex);
|
||||
if (service->sync)
|
||||
mutex_unlock(&state->sync_mutex);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Change the state while the mutex is still held */
|
||||
vchiq_set_service_state(service, VCHIQ_SRVSTATE_CLOSERECVD);
|
||||
|
|
Loading…
Reference in a new issue