OSDN Git Service

android: Fix error check from pthread_create
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>
Fri, 10 Jan 2014 01:24:23 +0000 (02:24 +0100)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 10 Jan 2014 15:45:17 +0000 (17:45 +0200)
pthread_create() returns 0 on success or errno code which is non negative
number

android/hal-audio.c
android/hal-ipc.c

index 01d8ebf..421832a 100644 (file)
@@ -547,10 +547,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);
        }
 
index b19704a..97f1bcd 100644 (file)
@@ -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);