Skip to contentSkip to conversation

net: caif: remove ineffective check

PATCH Applied Pan Bian 2 participants 2 messages Dec 4, 2016 – Dec 5, 2016

Subsystems (2)
lore
Share & tools
lore

Pan Bian

author
#0 lore raw

PATCH 1/1 net: caif: remove ineffective check

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

---
 net/caif/caif_socket.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
net/caif/caif_socket.c +1 -4
index aa209b1..92cbbd2 100644
@@ -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)
Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw

From: Pan Bian <[email protected]>
Date: Sun, 4 Dec 2016 12:15:44 +0800

Quoted 7 lines

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

Applied.