Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752508AbcLDES6 (ORCPT ); Sat, 3 Dec 2016 23:18:58 -0500 Received: from m50-132.163.com ([123.125.50.132]:55829 "EHLO m50-132.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752154AbcLDES4 (ORCPT ); Sat, 3 Dec 2016 23:18:56 -0500 From: Pan Bian To: Dmitry Tarnyagin , "David S. Miller" , Sergei Shtylyov , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH 1/1] net: caif: remove ineffective check Date: Sun, 4 Dec 2016 12:15:44 +0800 Message-Id: <1480824944-3439-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: DNGowAAX5PBwmENYbwOiIQ--.22490S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7Xr4kZF4kCF18KF48tr4xZwb_yoWDGwc_Cr W8Jw4Ut3Z29rs3C3y5CrsxXF93Xan8WFnaqF48A3W29w1fWr1avrZruFy3Ar1rWr4Ikr17 Grn5Jr92vw17ujkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUn55r7UUUUU== X-Originating-IP: [114.243.30.33] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/1tbiDhQ2clXlhmy7lgAAsp Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 948 Lines: 30 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 --- 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