[PATCH] route/link: Remove unnecessary NULL check before release_link_info()

Tobias Klauser tklauser at distanz.ch
Tue Jul 14 02:43:01 PDT 2015


release_link_info() already check whether link->l_info_ops is not NULL
before accessing it, thus there is no need to do the same before calling
it.

Signed-off-by: Tobias Klauser <tklauser at distanz.ch>
---
 lib/route/link.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/route/link.c b/lib/route/link.c
index 35946bd..bee1048 100644
--- a/lib/route/link.c
+++ b/lib/route/link.c
@@ -208,10 +208,7 @@ static void link_free_data(struct nl_object *c)
 	struct rtnl_link *link = nl_object_priv(c);
 
 	if (link) {
-		struct rtnl_link_info_ops *io;
-
-		if ((io = link->l_info_ops) != NULL)
-			release_link_info(link);
+		release_link_info(link);
 
 		/* proto info af reference */
 		rtnl_link_af_ops_put(link->l_af_ops);
@@ -2237,8 +2234,7 @@ int rtnl_link_set_type(struct rtnl_link *link, const char *type)
 
 	free(link->l_info_kind);
 	link->ce_mask &= ~LINK_ATTR_LINKINFO;
-	if (link->l_info_ops)
-		release_link_info(link);
+	release_link_info(link);
 
 	if (!type)
 		return 0;
-- 
2.2.2





More information about the libnl mailing list