Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932302AbbKQQnr (ORCPT ); Tue, 17 Nov 2015 11:43:47 -0500 Received: from mout.web.de ([212.227.17.12]:64270 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754449AbbKQQnn (ORCPT ); Tue, 17 Nov 2015 11:43:43 -0500 Subject: [PATCH] net-scm: Delete an unnecessary check before the function call "kfree" To: netdev@vger.kernel.org, "David S. Miller" References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <564B5937.1070707@users.sourceforge.net> Date: Tue, 17 Nov 2015 17:43:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <5317A59D.4@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:JYOG9EAqPWqVjhXpDfIEhzVNYaiD1ym5LJuwciNJEau0PGFp1gN vspiSFIRC8qhb5riUBvWAm+eE/cOdInvRnzwvT57wjKTqRKiEuazKhBMYHQ3WKnKWbXgoN5 KwX+yCh4wNV7MX4lV1nv8rE5Vm4lE6agoC6R0hPG+gsnN/oGn9eOYXNKi4rwy+j24heiZSx B3HoW11AH99Y75a2bYjRw== X-UI-Out-Filterresults: notjunk:1;V01:K0:SUUQW6SV/pg=:5bKqncuF+pX4qRLRQLsVYo Aoo+qSyIcX3rjVyNcHclEuQ7fhVO2p0HWoJnkQQpiXlbhAc5zeXfHf+qroZYBYeXBYFofzXIs uxqIgn1MZx8FcJO2LTNE7B+bzj0sgAE9Z+4R7Yk0d93rDX+JD9gkrG1F2dJjFTB3KXToVPO4O T/bP6sPfTX88s/iEdDFzNxcLwWqzX/P/aJPTDtZihjSh+JWxUkEU6nEu1Ap5r3s+OigvZsh+U Di+pZ9HkdoSOXZ7DWEDTS6L8/f6mBHd5WMbegAeR7M4kikJCRZar5oMgvmQFmRNib3tm9gxoT 2AxSKwDnF0NpRTmRXfwH0A2rGw+PLFfsSlxQ1NNbfkPZwh3tXN6zBmCQ1KDYykrkzs8cNuFT5 nY8t6PeT0nb2/W0zSbUGR8+HP9XMdePqT/JAk0Lw4TnqbI2bQjTuhyaKCGAiwudnWy2Mx0ql2 f/yMCrvjT2aJnkvcSNnpe6SDZaBbaX79Lo5Pd7JGWMHf75YYzaJWL/6eKsaQgT0N7x2cslDKt 8unbW+e0FmOeVsZvXCehGVLcFJ2EtB0r02qNvV7wpGiF1EXSyCSDCFh0isRR3Jv8TrkF3qFyX kbvltOD4wDN4/DQfASSlmxzagrxGqL8QgdAY3hcUiCz2AtKotFvPOT3xY4mAiPpKez4G7aYpH wvvVKj4Hxz8uwaLq1ObD77xXi7b2qgUXWHtozbZjBjq50VgY4vnxXprg2j3MyELqBIbFIBp4T Cx0hqqRr3PN0qpLoiTcw9OLmDj8b581di07Pp+057fNuoCWI6s7jXXb2ol/oysEjcAexTjuys A13LV3B Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 999 Lines: 34 From: Markus Elfring Date: Tue, 17 Nov 2015 17:37:22 +0100 The kfree() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- net/core/scm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/scm.c b/net/core/scm.c index 3b6899b..4f64173 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -193,7 +193,7 @@ int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *p) } } - if (p->fp && !p->fp->count) + if (likely(!p->fp->count)) { kfree(p->fp); p->fp = NULL; -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/