From: Lei Zhu <[email protected]>

The pthread_create() functions returns 0 on success and a positive value on
failure. Modify the return value check to correctly detect failure cases.

Fixes: 72696bd8a09d ("selftests: nci: Extract the start/stop discovery 
function")
Signed-off-by: Lei Zhu <[email protected]>
---
 tools/testing/selftests/nci/nci_dev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/nci/nci_dev.c 
b/tools/testing/selftests/nci/nci_dev.c
index 312f84ee0444..d2ce79daae39 100644
--- a/tools/testing/selftests/nci/nci_dev.c
+++ b/tools/testing/selftests/nci/nci_dev.c
@@ -438,7 +438,7 @@ FIXTURE_SETUP(NCI)
        else
                rc = pthread_create(&thread_t, NULL, virtual_dev_open,
                                    (void *)&self->virtual_nci_fd);
-       ASSERT_GT(rc, -1);
+       ASSERT_EQ(rc, 0);
 
        rc = send_cmd_with_idx(self->sd, self->fid, self->pid,
                               NFC_CMD_DEV_UP, self->dev_idex);
@@ -509,7 +509,7 @@ FIXTURE_TEARDOWN(NCI)
                        rc = pthread_create(&thread_t, NULL, virtual_deinit,
                                            (void *)&self->virtual_nci_fd);
 
-               ASSERT_GT(rc, -1);
+               ASSERT_EQ(rc, 0);
                rc = send_cmd_with_idx(self->sd, self->fid, self->pid,
                                       NFC_CMD_DEV_DOWN, self->dev_idex);
                EXPECT_EQ(rc, 0);
@@ -590,7 +590,7 @@ int start_polling(int dev_idx, int proto, int virtual_fd, 
int sd, int fid, int p
 
        rc = pthread_create(&thread_t, NULL, virtual_poll_start,
                            (void *)&virtual_fd);
-       if (rc < 0)
+       if (rc)
                return rc;
 
        rc = send_cmd_mt_nla(sd, fid, pid, NFC_CMD_START_POLL, 2, 
nla_start_poll_type,
@@ -610,7 +610,7 @@ int stop_polling(int dev_idx, int virtual_fd, int sd, int 
fid, int pid)
 
        rc = pthread_create(&thread_t, NULL, virtual_poll_stop,
                            (void *)&virtual_fd);
-       if (rc < 0)
+       if (rc)
                return rc;
 
        rc = send_cmd_with_idx(sd, fid, pid,
@@ -874,7 +874,7 @@ TEST_F(NCI, deinit)
        else
                rc = pthread_create(&thread_t, NULL, virtual_deinit,
                                    (void *)&self->virtual_nci_fd);
-       ASSERT_GT(rc, -1);
+       ASSERT_EQ(rc, 0);
 
        rc = send_cmd_with_idx(self->sd, self->fid, self->pid,
                               NFC_CMD_DEV_DOWN, self->dev_idex);
-- 
2.25.1


Reply via email to