[PATCH 1/7] netlink: Remove pointless checks

Denis Kenzior <[email protected]> Fri, 26 Jul 2024 11:12:13 -0500
Newsgroups dev.linux.lists.ell
Message-ID <[email protected]>
command_queue, command_pending and command_lookup structures are always
initialized at construction time and are not destroyed until l_netlink
destruction.  There's no need to check whether they ar valid.
---
 ell/netlink.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/ell/netlink.c b/ell/netlink.c
index 024740b62fc3..26c31679e4c7 100644
--- a/ell/netlink.c
+++ b/ell/netlink.c
@@ -410,10 +410,6 @@ LIB_EXPORT unsigned int l_netlink_send(struct l_netlink *netlink,
 	if (unlikely(!netlink))
 		return 0;
 
-	if (!netlink->command_queue || !netlink->command_pending ||
-						!netlink->command_lookup)
-		return 0;
-
 	if (flags & 0xff)
 		return 0;
 
@@ -471,10 +467,6 @@ LIB_EXPORT bool l_netlink_cancel(struct l_netlink *netlink, unsigned int id)
 	if (unlikely(!netlink || !id))
 		return false;
 
-	if (!netlink->command_queue || !netlink->command_pending ||
-						!netlink->command_lookup)
-		return false;
-
 	command = l_hashmap_remove(netlink->command_lookup, L_UINT_TO_PTR(id));
 	if (!command)
 		return false;
-- 
2.45.2