summaryrefslogtreecommitdiffstats
path: root/drivers/staging/vc04_services
diff options
context:
space:
mode:
authorStefan Wahren <stefan.wahren@i2se.com>2021-04-25 12:50:54 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-10 11:19:27 +0200
commitbd18b980a21d9654143e7b5167ab82e82c706798 (patch)
treede19751a6dbf28b24bc1b468db9d61e3ae448c50 /drivers/staging/vc04_services
parentbdf2b26de6124a175d03092e89610f15ebc6a733 (diff)
downloadlinux-bd18b980a21d9654143e7b5167ab82e82c706798.tar.bz2
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>
Diffstat (limited to 'drivers/staging/vc04_services')
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 517a8c9b41ed..8a1e6f5a11bb 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -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);