From patchwork Sat Nov 14 21:50:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 7617461 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E0D389F1D3 for ; Sat, 14 Nov 2015 21:51:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DE46D2060B for ; Sat, 14 Nov 2015 21:51:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1976A2060A for ; Sat, 14 Nov 2015 21:51:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751882AbbKNVuy (ORCPT ); Sat, 14 Nov 2015 16:50:54 -0500 Received: from mout.web.de ([212.227.15.4]:60311 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbbKNVuv (ORCPT ); Sat, 14 Nov 2015 16:50:51 -0500 Received: from [192.168.1.3] ([77.181.187.123]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0MKaDH-1ZvnJ642fn-001vfs; Sat, 14 Nov 2015 22:50:36 +0100 Subject: [PATCH] NFC-nci: Delete unnecessary checks before the function call "kfree_skb" 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> To: Aloisio Almeida Jr , "David S. Miller" , Lauro Ramos Venancio , Samuel Ortiz , Vincent Cuissard , linux-wireless@vger.kernel.org, netdev@vger.kernel.org From: SF Markus Elfring X-Enigmail-Draft-Status: N1110 Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Message-ID: <5647ACA7.3000905@users.sourceforge.net> Date: Sat, 14 Nov 2015 22:50:31 +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> X-Provags-ID: V03:K0:HW0HFQvLWEthEuj4qM5Wbx9u63jt93ldMWAjTjje8uJoijTFDD8 Xc0dMBkKw8J8fTXzQr4JTW5kg1QJEcFyNqwKGGnWs/POSGWg1fM7GGC8M+AyizvFDi4NJVb JZFiLY27GI1TYFlwazd3tAQVK+iBSpKWYmuYOfn5kXWP8Y/eeq+lLurfvMsEMP/ieu5FMpG 2q+oQdhdHVgw44PcnO+GA== X-UI-Out-Filterresults: notjunk:1; V01:K0:0okg/0FtTt8=:a9NY8fBlEcHwIKKqj/kFui /9RdIsrK4akHk8mQc9tiejfQkOxOIDKSxmkn2BeJunB8Hy/996aJHPrEFHo5O1vMb1jb0yt75 BvBgnRKpP4fcRg/6E2+Oo7ociBx8nsBArXgNFrVahV1akOTUO9lZZ/da6r75RU/MBdxuqWSkK CTII8GRzcG+Yq/+R3pqXDl2BxnNXxM+8YgAwuarZ9H6ziEwgUXGoH2zF1RUXCJm+togGaEiz6 WJ8ZEVnWwPdENcnKl09Hn8gsmgoOl51UKmoRyX/gqtlCL8tO9JvJ2xj2JTmZ3d2ri+MY1IqVs kuXxTBLCkS1tfSxItZcEtHTN7t8ZRl0ngYEXnwtXTBQc0S9BEUPyTaA75f3NIVKE5qrgqPmhv 5apO4o0TzqgUAYvGQvxW6tE8RRLy60WwmbU19ZwG5nTYuoFkvWr49nSvel31Ci0Hwj0guLVW6 GldAKU2SFZzzpDnuWFav1yvgTYDgr1doWyIoSBkoYrFnMPU4nQos0fjNvzYnvqlIwJYQTmchT 9G0iLBhqjxcP5su//AZEyG7+LbyrfS0l9EWAOYbmarCM3Elq0Zl5fX9p/JqVOL8NlkKbvKiUF RSAsTYg1IPQQtOv3NhmiTo5V3J+1V9RFhptZnPA2lKvxo40SBYNMwmI3cheYfboDLj2ocUMdN 24k0AvRWVbegYkeu5/Wiqta8wxSOg5bZU/bSKk+3fNT9kWX1K/EWPomZyDftG2l3r1t865EHu BhRU4Fo+KZEWfpE9WAyOsn2GxB9upV02y0p0tZluNWVzPeKOIkNCRDkTyddkPHDxSMjwOySnR ibvdAq9 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 14 Nov 2015 22:42:48 +0100 The kfree_skb() function tests whether its argument is NULL and then returns immediately. Thus the test around the calls is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- net/nfc/nci/uart.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c index 21d8875..106ecc1 100644 --- a/net/nfc/nci/uart.c +++ b/net/nfc/nci/uart.c @@ -199,11 +199,8 @@ static void nci_uart_tty_close(struct tty_struct *tty) if (!nu) return; - if (nu->tx_skb) - kfree_skb(nu->tx_skb); - if (nu->rx_skb) - kfree_skb(nu->rx_skb); - + kfree_skb(nu->tx_skb); + kfree_skb(nu->rx_skb); skb_queue_purge(&nu->tx_q); nu->ops.close(nu);