netlink: Return -EBUSY if some notifier was setup in netlink_notifier_setup

Change-Id: I62d036bb43420934efbf0e9b990ca2cf3dd0b2e5
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2020-04-08 01:52:32 +08:00 committed by patacongo
parent 3421ec90b4
commit e6c30629a1

View file

@ -79,6 +79,11 @@ int netlink_notifier_setup(worker_t worker, FAR struct netlink_conn_s *conn,
DEBUGASSERT(worker != NULL && conn != NULL);
if (conn->key > 0)
{
return -EBUSY;
}
/* This is just a simple wrapper around work_notifer_setup(). */
info.evtype = WORK_NETLINK_RESPONSE;
@ -88,7 +93,7 @@ int netlink_notifier_setup(worker_t worker, FAR struct netlink_conn_s *conn,
info.worker = worker;
conn->key = work_notifier_setup(&info);
return OK;
return conn->key;
}
/****************************************************************************