Skip to contentSkip to conversation

opensm: Fix pthread_create() return value checks

PATCH In review Bart Van Assche 2 participants 2 messages Jun 7, 2012 – Jun 13, 2012 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 opensm: Fix pthread_create() return value checks

Just like other POSIX thread functions, pthread_create() either returns zero or a positive error code. Found this through source code review. See also
http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_create.html

---
 complib/cl_threadpool.c       |    2 +-
 libvendor/osm_vendor_ibumad.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
complib/cl_threadpool.c +1 -1
index 4440808..0f6498b 100644
@@ -105,7 +105,7 @@ cl_status_t cl_thread_pool_init(IN cl_thread_pool_t * const p_thread_pool,
 
 	for (i = 0; i < count; i++) {
 		if (pthread_create(&p_thread_pool->tid[i], NULL,
-				   thread_pool_routine, p_thread_pool) < 0) {
+				   thread_pool_routine, p_thread_pool) != 0) {
 			cl_thread_pool_destroy(p_thread_pool);
 			return CL_INSUFFICIENT_RESOURCES;
 		}
libvendor/osm_vendor_ibumad.c +1 -1
index 9b7168b..bb40e8b 100644
@@ -425,7 +425,7 @@ static int umad_receiver_start(osm_vendor_t * p_vend)
 	p_ur->p_vend = p_vend;
 	p_ur->p_log = p_vend->p_log;
 
-	if (pthread_create(&p_ur->tid, NULL, umad_receiver, p_ur) < 0)
+	if (pthread_create(&p_ur->tid, NULL, umad_receiver, p_ur) != 0)
 		return -1;
 
 	return 0;
Signature · 7 lines
1.7.7


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi Bart,

Quoted 6 lines · Bart Van Assche

Just like other POSIX thread functions, pthread_create() either returns zero or a positive error code. Found this through source code review. See also
http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_create.html

---

Applied. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html