[PATCH] tools: usb: ffs-test: fix pthread_join return value check

longlong yan <[email protected]>
Newsgroups org.kernel.vger.linux-usb
Message-ID <[email protected]>
pthread_join() returns 0 on success or a positive error number on
failure. It never returns a negative value, so the "if (ret < 0)"
check in join_thread() is always false and the error path is dead
code.

Use "if (ret)" instead to correctly detect thread join failures.

Fixes: 93f2aa4ddd25 ("USB: ffs-test: FunctionFS testing program")
Signed-off-by: longlong yan <[email protected]>
---
 tools/usb/ffs-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c
index 22b938fbdfb7..dd8a1d537971 100644
--- a/tools/usb/ffs-test.c
+++ b/tools/usb/ffs-test.c
@@ -473,7 +473,7 @@ static void join_thread(struct thread *t)
 {
 	int ret = pthread_join(t->id, NULL);
 
-	if (ret < 0)
+	if (ret)
 		err("%s: joining thread", t->filename);
 	else
 		debug("%s: joined\n", t->filename);
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.