Thread (4 messages) 4 messages, 3 authors, 2016-12-03

Re: [PATCH 1/1] net: caif: fix ineffective error check

flat view

From: Sergei Shtylyov <hidden>
Date: 2016-12-03 21:05:53
Also in: lkml

On 12/03/2016 06:38 PM, Pan Bian wrote:
quoted
quoted
In function caif_sktinit_module(), the check of the return value of
sock_register() seems ineffective. This patch fixes it.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188751

Signed-off-by: Pan Bian <redacted>
---
net/caif/caif_socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index aa209b1..2a689a3 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -1108,7 +1108,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)
+	if (err)
		return err;
   Why not just:

	return sock_register(&caif_family_ops);
	Your solution looks much cleaner.

	But I am not really sure whether it is the author's intention to
	return 0 anyway. Do you have any idea?
   I don't think so, the error check seems to have a typo.

[...]
Best regards,
Pan
MBR, Sergei
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help