diff --git a/net/netlink/netlink.h b/net/netlink/netlink.h index ccb88d5663..b1ebf8e0b7 100644 --- a/net/netlink/netlink.h +++ b/net/netlink/netlink.h @@ -385,7 +385,7 @@ int netlink_notifier_setup(worker_t worker, FAR struct netlink_conn_s *conn, * ****************************************************************************/ -void netlink_notifier_teardown(FAR struct netlink_conn_s *conn); +void netlink_notifier_teardown(FAR void *conn); /**************************************************************************** * Name: netlink_notifier_signal diff --git a/net/netlink/netlink_conn.c b/net/netlink/netlink_conn.c index 0bea2a5021..0a1b5f71da 100644 --- a/net/netlink/netlink_conn.c +++ b/net/netlink/netlink_conn.c @@ -41,6 +41,7 @@ #include #include #include +#include #include "utils/utils.h" #include "netlink/netlink.h" @@ -533,7 +534,9 @@ int netlink_get_response(FAR struct netlink_conn_s *conn, { /* Wait for a response to be queued */ + tls_cleanup_push(tls_get_info(), netlink_notifier_teardown, conn); ret = net_sem_wait(&waitsem); + tls_cleanup_pop(tls_get_info(), 0); } /* Clean-up the semaphore */ diff --git a/net/netlink/netlink_notifier.c b/net/netlink/netlink_notifier.c index 9b85ecf814..d8a0fc884e 100644 --- a/net/netlink/netlink_notifier.c +++ b/net/netlink/netlink_notifier.c @@ -97,8 +97,9 @@ int netlink_notifier_setup(worker_t worker, FAR struct netlink_conn_s *conn, * ****************************************************************************/ -void netlink_notifier_teardown(FAR struct netlink_conn_s *conn) +void netlink_notifier_teardown(FAR void *arg) { + FAR struct netlink_conn_s *conn = arg; DEBUGASSERT(conn != NULL); /* This is just a simple wrapper around work_notifier_teardown(). */