Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752589AbcLCQ3W (ORCPT ); Sat, 3 Dec 2016 11:29:22 -0500 Received: from m50-133.163.com ([123.125.50.133]:57208 "EHLO m50-133.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751241AbcLCQ3U (ORCPT ); Sat, 3 Dec 2016 11:29:20 -0500 From: Pan Bian To: Sergei Shtylyov , Dmitry Tarnyagin , "David S. Miller" Cc: PanBian , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] net: caif: fix ineffective error check Date: Sat, 3 Dec 2016 23:38:56 +0800 Message-Id: <20161203153535.GA7976@bp> X-Mailer: git-send-email 1.9.1 Reply-To: PanBian References: <1480763901-5323-1-git-send-email-bianpan2016@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-CM-TRANSID: DdGowAAXCKgX50JYL2hNIw--.7211S3 X-Coremail-Antispam: 1Uf129KBjvJXoWrKr1DGr1xtw48Gw1xAryUtrb_yoW8Jr1UpF WfKr9rCanFgw4xWFs5XF4rZryY9w40qr1xur1rXrn0vrWDur1Yqa40ka15WF1UWr1Yka18 Jr4jqF1av3s8AFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07b0YFXUUUUU= X-Originating-IP: [222.131.246.88] X-CM-SenderInfo: held01tdqsiiqwqsqiywtou0bp/xtbBlxk14FSISk6amAAAsB Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1210 Lines: 49 From: PanBian Hello Sergei, On Sat, Dec 03, 2016 at 04:17:51PM +0300, Sergei Shtylyov wrote: > Hello. > > On 12/3/2016 2:18 PM, Pan Bian wrote: > > >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 > >--- > > 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? Thanks! > > return 0; > > } > > MBR, Sergei > Best regards, Pan