[PATCH v2 2/7] android: Fix error check from pthread_create

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

 



pthread_create() returns 0 on success or errno code which is non negative
number

---
 android/hal-audio.c | 4 ++--
 android/hal-ipc.c   | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/android/hal-audio.c b/android/hal-audio.c
index 4b48783..c71b93c 100644
--- a/android/hal-audio.c
+++ b/android/hal-audio.c
@@ -548,10 +548,10 @@ static int audio_open(const hw_module_t *module, const char *name,
 	*device = &a2dp_dev->dev.common;
 
 	err = pthread_create(&ipc_th, NULL, ipc_handler, NULL);
-	if (err < 0) {
+	if (err) {
 		ipc_th = 0;
 		error("audio: Failed to start Audio IPC thread: %d (%s)",
-							-err, strerror(-err));
+							err, strerror(err));
 		return (-err);
 	}
 
diff --git a/android/hal-ipc.c b/android/hal-ipc.c
index b19704a..97f1bcd 100644
--- a/android/hal-ipc.c
+++ b/android/hal-ipc.c
@@ -284,10 +284,10 @@ bool hal_ipc_init(void)
 	close(sk);
 
 	err = pthread_create(&notif_th, NULL, notification_handler, NULL);
-	if (err < 0) {
+	if (err) {
 		notif_th = 0;
-		error("Failed to start notification thread: %d (%s)", -err,
-							strerror(-err));
+		error("Failed to start notification thread: %d (%s)", err,
+							strerror(err));
 		close(cmd_sk);
 		cmd_sk = -1;
 		close(notif_sk);
-- 
1.8.4

--
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