Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp782735ybl; Thu, 22 Aug 2019 04:58:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtkVdkp3iN6cNg5k4hkhBG/N37j5TrU3sqYJEfW203UZWh+opCC9ne6YAW47m+Donhd2hl X-Received: by 2002:a17:90a:a105:: with SMTP id s5mr5024556pjp.51.1566475118934; Thu, 22 Aug 2019 04:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566475118; cv=none; d=google.com; s=arc-20160816; b=AO+aBmfvl2XnFB0rDvSwU8oi1WhomerWfY/crX9iHZR3G83mBZrFDcP5wQ9/ccwdMg CX2nGhBFkEUFcZff6m+x19lxuIOLNErmBlPKRXytMEwm2IJ7MWOYLbiOQQ4Hdfg/Tu1M HmdhmOxk9tu3LSQmRei6cSHywJe4AgC8N3IKTMcaiKAGwVStoEZaguCtvPkKA8NvLwxn 4YPbsrYlFALwsQHkWZHn4aaWucx8JYtchKINfQabxGsnfkLfsDfJyRXNUQHf30HN/j7h IWIgy+yx9PWhdyFGylrnx6mIB0+oK17MiPQGiFX9JlyCiez6JpCzJzsinP4jtkEcqJbb LMOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=mVdvhkqr3JlQdyT+WTLNevUYToi1Z2/UK0QjIrc3YRM=; b=h+gMRv64ON/bHV7uhoBhs8e02/x+CmYWMjNa2TWUQ6rD2NO3T2BYfQOJGXy0mY/V6/ VD1geNqCklhRkVp/V91gArsYFSKInYShrS4fjz239CMkqyleWgTuld0OUyuVKKCovaDI LLJDq43X6DQgkrFrp0AfKpVe8mAds7rTCXBbD4vV4MlYa16/E8f6RZNViOJ6VstydOcc 0bTjErtMy/95nxvYJn39GDbhoWWKjUDVZUca/O7r8LeP+82fnjOThnlZf1wg/ZMhxsmU c6fqHMke1Or7aD7gAEo/dxKBEZFbVSoI3ZxCNlsrbDgDscUXzM/0wKShq9lRHz4WwPKp 3DQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@geanix.com header.s=first header.b="PcuOy/1n"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=geanix.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l65si12417351plb.312.2019.08.22.04.58.23; Thu, 22 Aug 2019 04:58:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@geanix.com header.s=first header.b="PcuOy/1n"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=geanix.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733071AbfHVJOD (ORCPT + 99 others); Thu, 22 Aug 2019 05:14:03 -0400 Received: from first.geanix.com ([116.203.34.67]:51054 "EHLO first.geanix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733031AbfHVJOC (ORCPT ); Thu, 22 Aug 2019 05:14:02 -0400 Received: from [10.130.30.123] (unknown [89.221.170.34]) by first.geanix.com (Postfix) with ESMTPSA id 5E7DA26C; Thu, 22 Aug 2019 09:13:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1566465226; bh=asXzZBQBNt4GDuGVIHuNtW2Y0ft96E4G10anvfYUF/8=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=PcuOy/1n0ks2lfIy7rEPtHSNPB2ib/EcUFsL6j04f7IuVtitWCIrrbzy2RxBOk6pC T5y8EKSLj/pjQ8FgbkhZaj6hGRxI7rvSoM/QtZhuuuKViecd0e7vNqsRdY+hfhkutL 1CzgKOitxDGY+xnWHfSElnGpvJjFTDgHZIdTRV8H8Ns86uXP8fpz6t7Nxk9pjJJ0zv H2CRY3EibutmIC7wN7clZe0YDPLOgXuGgvcngxyjGSSySP6f98r56hvBd4lKzH3Z6M lrUIbnWrVCGdp8fi+/9jqd1HrhXpDH6pxWd39w3/bU2FaD2zYpJgk04OsgbfbwZqfE uNps0ZMwytgBg== Subject: =?UTF-8?Q?Re=3a_=5bPATCH=5d_can=3a_Delete_unnecessary_checks_before?= =?UTF-8?B?IHRoZSBtYWNybyBjYWxsIOKAnGRldl9rZnJlZV9za2LigJ0=?= To: Markus Elfring , linux-can@vger.kernel.org, netdev@vger.kernel.org, Allison Randal , "David S. Miller" , Enrico Weigelt , Greg Kroah-Hartman , "Gustavo A. R. Silva" , Lukas Wunner , Marc Kleine-Budde , Thomas Gleixner , Weitao Hou , Wolfgang Grandegger Cc: LKML , kernel-janitors@vger.kernel.org References: <27674907-fd2a-7f0c-84fd-d8b5124739a9@web.de> From: Sean Nyekjaer Message-ID: Date: Thu, 22 Aug 2019 11:13:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <27674907-fd2a-7f0c-84fd-d8b5124739a9@web.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US-large Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=4.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED autolearn=disabled version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on 77834cc0481d Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/08/2019 21.30, Markus Elfring wrote: > From: Markus Elfring > Date: Wed, 21 Aug 2019 21:16:15 +0200 > > The dev_kfree_skb() function performs also input parameter validation. > Thus the test around the shown calls is not needed. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring Acked-by: Sean Nyekjaer > --- > drivers/net/can/spi/hi311x.c | 3 +-- > drivers/net/can/spi/mcp251x.c | 3 +-- > 2 files changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c > index 03a711c3221b..7c7c7e78214c 100644 > --- a/drivers/net/can/spi/hi311x.c > +++ b/drivers/net/can/spi/hi311x.c > @@ -184,8 +184,7 @@ static void hi3110_clean(struct net_device *net) > > if (priv->tx_skb || priv->tx_len) > net->stats.tx_errors++; > - if (priv->tx_skb) > - dev_kfree_skb(priv->tx_skb); > + dev_kfree_skb(priv->tx_skb); > if (priv->tx_len) > can_free_echo_skb(priv->net, 0); > priv->tx_skb = NULL; > diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c > index 12358f06d194..1c496d2adb45 100644 > --- a/drivers/net/can/spi/mcp251x.c > +++ b/drivers/net/can/spi/mcp251x.c > @@ -274,8 +274,7 @@ static void mcp251x_clean(struct net_device *net) > > if (priv->tx_skb || priv->tx_len) > net->stats.tx_errors++; > - if (priv->tx_skb) > - dev_kfree_skb(priv->tx_skb); > + dev_kfree_skb(priv->tx_skb); > if (priv->tx_len) > can_free_echo_skb(priv->net, 0); > priv->tx_skb = NULL; > -- > 2.23.0 > Good catch Markus :-) /Sean