]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: vchiq_core: Lower indentation in vchiq_close_service_internal
authorUmang Jain <umang.jain@ideasonboard.com>
Sun, 13 Oct 2024 11:21:28 +0000 (16:51 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Oct 2024 13:47:35 +0000 (15:47 +0200)
Reduce indentation of the conditional nesting in
vchiq_close_service_internal() switch case by checking the error paths
first and break early. This helps to reduce conditional branching and
reduce indentation levels.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20241013112128.397249-7-umang.jain@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c

index 36f08f078564188c2cc9514aec66056e1fbc41a0..3d347b425f209c8237627a230f2cf848ff530748 100644 (file)
@@ -3163,19 +3163,21 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd)
                if (close_recvd) {
                        dev_err(state->dev, "core: (1) called in state %s\n",
                                srvstate_names[service->srvstate]);
-               } else if (is_server) {
-                       if (service->srvstate == VCHIQ_SRVSTATE_LISTENING) {
-                               status = -EINVAL;
-                       } else {
-                               service->client_id = 0;
-                               service->remoteport = VCHIQ_PORT_FREE;
-                               if (service->srvstate == VCHIQ_SRVSTATE_CLOSEWAIT)
-                                       set_service_state(service, VCHIQ_SRVSTATE_LISTENING);
-                       }
-                       complete(&service->remove_event);
-               } else {
+                       break;
+               } else if (!is_server) {
                        vchiq_free_service_internal(service);
+                       break;
+               }
+
+               if (service->srvstate == VCHIQ_SRVSTATE_LISTENING) {
+                       status = -EINVAL;
+               } else {
+                       service->client_id = 0;
+                       service->remoteport = VCHIQ_PORT_FREE;
+                       if (service->srvstate == VCHIQ_SRVSTATE_CLOSEWAIT)
+                               set_service_state(service, VCHIQ_SRVSTATE_LISTENING);
                }
+               complete(&service->remove_event);
                break;
        case VCHIQ_SRVSTATE_OPENING:
                if (close_recvd) {