netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netlink: cleanup the unnecessary return value check
@ 2012-10-23  8:21 zhanghonghui
  2012-10-23 17:04 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: zhanghonghui @ 2012-10-23  8:21 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-kernel, lizefan, edumazet, Hans Zhang

From: Hans Zhang <zhanghonghui@huawei.com>

It's no needed to check the return value of tab since the NULL situation
has been handled already, and the rtnl_msg_handlers[PF_UNSPEC] has been
initialized as non-NULL during the rtnetlink_init().

Signed-off-by: Hans Zhang <zhanghonghui@huawei.com>
---
 net/core/rtnetlink.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 76d4c2c..64fe3cc 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -128,7 +128,7 @@ static rtnl_doit_func rtnl_get_doit(int protocol, int msgindex)
 	if (tab == NULL || tab[msgindex].doit == NULL)
 		tab = rtnl_msg_handlers[PF_UNSPEC];
 
-	return tab ? tab[msgindex].doit : NULL;
+	return tab[msgindex].doit;
 }
 
 static rtnl_dumpit_func rtnl_get_dumpit(int protocol, int msgindex)
@@ -143,7 +143,7 @@ static rtnl_dumpit_func rtnl_get_dumpit(int protocol, int msgindex)
 	if (tab == NULL || tab[msgindex].dumpit == NULL)
 		tab = rtnl_msg_handlers[PF_UNSPEC];
 
-	return tab ? tab[msgindex].dumpit : NULL;
+	return tab[msgindex].dumpit;
 }
 
 static rtnl_calcit_func rtnl_get_calcit(int protocol, int msgindex)
@@ -158,7 +158,7 @@ static rtnl_calcit_func rtnl_get_calcit(int protocol, int msgindex)
 	if (tab == NULL || tab[msgindex].calcit == NULL)
 		tab = rtnl_msg_handlers[PF_UNSPEC];
 
-	return tab ? tab[msgindex].calcit : NULL;
+	return tab[msgindex].calcit;
 }
 
 /**
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] netlink: cleanup the unnecessary return value check
  2012-10-23  8:21 [PATCH] netlink: cleanup the unnecessary return value check zhanghonghui
@ 2012-10-23 17:04 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-10-23 17:04 UTC (permalink / raw)
  To: zhanghonghui; +Cc: netdev, linux-kernel, lizefan, edumazet

From: <zhanghonghui@huawei.com>
Date: Tue, 23 Oct 2012 16:21:23 +0800

> From: Hans Zhang <zhanghonghui@huawei.com>
> 
> It's no needed to check the return value of tab since the NULL situation
> has been handled already, and the rtnl_msg_handlers[PF_UNSPEC] has been
> initialized as non-NULL during the rtnetlink_init().
> 
> Signed-off-by: Hans Zhang <zhanghonghui@huawei.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-23 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-23  8:21 [PATCH] netlink: cleanup the unnecessary return value check zhanghonghui
2012-10-23 17:04 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).