From patchwork Wed Dec 11 08:42:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wangweidong X-Patchwork-Id: 299876 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7C0BC2C0086 for ; Wed, 11 Dec 2013 19:43:10 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750990Ab3LKImz (ORCPT ); Wed, 11 Dec 2013 03:42:55 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:53161 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750791Ab3LKImx (ORCPT ); Wed, 11 Dec 2013 03:42:53 -0500 Received: from 172.24.2.119 (EHLO szxeml207-edg.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AHM74473; Wed, 11 Dec 2013 16:42:21 +0800 (CST) Received: from SZXEML424-HUB.china.huawei.com (10.82.67.163) by szxeml207-edg.china.huawei.com (172.24.2.56) with Microsoft SMTP Server (TLS) id 14.3.158.1; Wed, 11 Dec 2013 16:42:17 +0800 Received: from [127.0.0.1] (10.135.68.79) by szxeml424-hub.china.huawei.com (10.82.67.163) with Microsoft SMTP Server id 14.3.158.1; Wed, 11 Dec 2013 16:42:17 +0800 Message-ID: <52A82566.1050601@huawei.com> Date: Wed, 11 Dec 2013 16:42:14 +0800 From: Wang Weidong User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Vlad Yasevich , Neil Horman , David Miller CC: , Subject: [PATCH net-next] sctp: remove redundant null check on asoc X-Originating-IP: [10.135.68.79] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In sctp_err_lookup, goto out while the asoc is not NULL, so remove the check NULL. Also, in sctp_err_finish which called by sctp_v4_err and sctp_v6_err, they pass asoc to sctp_err_finish while the asoc is not NULL, so remove the check. Signed-off-by: Wang Weidong Acked-by: Neil Horman Acked-by: Vlad Yasevich --- net/sctp/input.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/sctp/input.c b/net/sctp/input.c index 6603853..2a192a7 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c @@ -536,8 +536,7 @@ struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *skb, return sk; out: - if (asoc) - sctp_association_put(asoc); + sctp_association_put(asoc); return NULL; } @@ -545,8 +544,7 @@ out: void sctp_err_finish(struct sock *sk, struct sctp_association *asoc) { sctp_bh_unlock_sock(sk); - if (asoc) - sctp_association_put(asoc); + sctp_association_put(asoc); } /*