[PATCH 06/10] android/hal-ipc: Move exit calls under label in notification_handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This reduce number of exit points in preparation for destroy callback.
---
 android/hal-ipc.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/android/hal-ipc.c b/android/hal-ipc.c
index 2cc6eda..59bc3dc 100644
--- a/android/hal-ipc.c
+++ b/android/hal-ipc.c
@@ -154,9 +154,9 @@ static void *notification_handler(void *data)
 
 		ret = recvmsg(notif_sk, &msg, 0);
 		if (ret < 0) {
-			error("Receiving notifications failed, aborting :%s",
+			error("Receiving notifications failed: %s",
 							strerror(errno));
-			exit(EXIT_FAILURE);
+			goto failed;
 		}
 
 		/* socket was shutdown */
@@ -168,8 +168,8 @@ static void *notification_handler(void *data)
 			}
 			pthread_mutex_unlock(&cmd_sk_mutex);
 
-			error("Notification socket closed, aborting");
-			exit(EXIT_FAILURE);
+			error("Notification socket closed");
+			goto failed;
 		}
 
 		fd = -1;
@@ -185,7 +185,7 @@ static void *notification_handler(void *data)
 		}
 
 		if (!handle_msg(buf, ret))
-			exit(EXIT_FAILURE);
+			goto failed;
 	}
 
 	close(notif_sk);
@@ -196,6 +196,9 @@ static void *notification_handler(void *data)
 	DBG("exit");
 
 	return NULL;
+
+failed:
+	exit(EXIT_FAILURE);
 }
 
 static int accept_connection(int sk)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux