diff --git a/components/pthreads/pthread_tls.c b/components/pthreads/pthread_tls.c
index 0fda158a3958d96bceb8d53fe95b4460b9e7dcc0..c01840df59f2e0a94cce1bd7258df5a94044f1d1 100644
--- a/components/pthreads/pthread_tls.c
+++ b/components/pthreads/pthread_tls.c
@@ -31,7 +31,10 @@ int pthread_setspecific(pthread_key_t key, const void *value)
 	RT_ASSERT(ptd != NULL);
 
 	/* check tls area */
-	if (ptd->tls == NULL) ptd->tls = rt_malloc(sizeof(void*) * PTHREAD_KEY_MAX);
+	if (ptd->tls == NULL)
+	{
+		ptd->tls = (void**)rt_malloc(sizeof(void*) * PTHREAD_KEY_MAX);
+	}
 
 	if ((key < PTHREAD_KEY_MAX) && _thread_keys[key].is_used)
 	{