* [PATCH 1/1] net: caif: remove ineffective check
@ 2016-12-04 4:15 Pan Bian
2016-12-05 19:49 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2016-12-04 4:15 UTC (permalink / raw)
To: Dmitry Tarnyagin, David S. Miller, Sergei Shtylyov, netdev
Cc: linux-kernel, Pan Bian
The check of the return value of sock_register() is ineffective.
"if(!err)" seems to be a typo. It is better to propagate the error code
to the callers of caif_sktinit_module(). This patch removes the check
statment and directly returns the result of sock_register().
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188751
Signed-off-by: Pan Bian <bianpan2016@163.com>
---
net/caif/caif_socket.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index aa209b1..92cbbd2 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -1107,10 +1107,7 @@ static int caif_create(struct net *net, struct socket *sock, int protocol,
static int __init caif_sktinit_module(void)
{
- int err = sock_register(&caif_family_ops);
- if (!err)
- return err;
- return 0;
+ return sock_register(&caif_family_ops);
}
static void __exit caif_sktexit_module(void)
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] net: caif: remove ineffective check
2016-12-04 4:15 [PATCH 1/1] net: caif: remove ineffective check Pan Bian
@ 2016-12-05 19:49 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-12-05 19:49 UTC (permalink / raw)
To: bianpan2016; +Cc: dmitry.tarnyagin, sergei.shtylyov, netdev, linux-kernel
From: Pan Bian <bianpan2016@163.com>
Date: Sun, 4 Dec 2016 12:15:44 +0800
> The check of the return value of sock_register() is ineffective.
> "if(!err)" seems to be a typo. It is better to propagate the error code
> to the callers of caif_sktinit_module(). This patch removes the check
> statment and directly returns the result of sock_register().
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188751
> Signed-off-by: Pan Bian <bianpan2016@163.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-05 19:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-04 4:15 [PATCH 1/1] net: caif: remove ineffective check Pan Bian
2016-12-05 19:49 ` 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).