Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1266555ybl; Fri, 23 Aug 2019 16:32:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAHPLmxqAcLmOBrDYOBHkMOjrD+tlVfYcrUjGRvlfkEOkcLUBnvJRa21IlheP2WIXHKaxw X-Received: by 2002:a63:7205:: with SMTP id n5mr5989491pgc.443.1566603144326; Fri, 23 Aug 2019 16:32:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566603144; cv=none; d=google.com; s=arc-20160816; b=fZvOWTlTQOYxWUdcsT7UyaafV2OJQfrAnl1KQTvy+6DGYN0TgzFI19evWrBGzIEEAE 8IVKQRatQpHadV/QYMsS9yuRs2iev63flnGapZvAlfkCEdyLRRGHXBTpGWDyfCn9yYlw StE75HJKx3I7BjEEcAi2TJEE9Uj8HDVwto9j52TLNBJDm3X9kqylxwfM8VLDuzivcvdU ca/FKNLpimbLo9Tqxt8va7Ze+Y/0yRRyq7iGQ+c/R05OfgD9WtWug2/ZlPk2v3QsTD/z K+N1DwNRc3eEQF5dDSMMWXH6TXa0qeggedKIaAmzKFgGcO9+OC0wYsLBU+lOPhOCIWyf +bvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=brEz57KSv9M0lzRju932ZTp5uWTNGJMBeYQNt57q3B8=; b=W1XIMcPR89ZWz/zEvBNJfwywOtcgv685kpibNktd0sqGCDpsEqo1hGEtikMxAty5d7 XEz5UC7ed+hy2rMcb0UXhsRP6sxknDCI8qcsiNNhG4Ams0+gusjOhHpM3AMCX2CZsBIf lVd18qjgHMKtO+JnHqamF5TOd/L9LBJBUDDoFYcihGDRagGz/TR5uOdlwFI+wj1vZYXv xnkdu4HA1KAlWkinLCPam4oqllRONqPVtJKdlynAUJ+t12jQbMS2AEPFNbW+vx8a72Mp wzHtdCA6j43vEJ3IDYDIZPyQIR725CBqIWN4ohjxX+fQROyBBSXgNZmQN01hhF2m/PEO z58A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=LSk4JaiG; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y9si3811082pfm.236.2019.08.23.16.32.09; Fri, 23 Aug 2019 16:32:24 -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=@broadcom.com header.s=google header.b=LSk4JaiG; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389163AbfHWQKL (ORCPT + 99 others); Fri, 23 Aug 2019 12:10:11 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:41489 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388997AbfHWQKK (ORCPT ); Fri, 23 Aug 2019 12:10:10 -0400 Received: by mail-pl1-f196.google.com with SMTP id m9so5808935pls.8 for ; Fri, 23 Aug 2019 09:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=brEz57KSv9M0lzRju932ZTp5uWTNGJMBeYQNt57q3B8=; b=LSk4JaiG3kNahJym5ph4p7/DJszhGCxXYsNz9CSryZBvZSEWdvgKnM9o/iYlhJpnhY CIxBe/BWxYQDTnOwVGPWaxb7855aVGTWS2LKsP+jgxko4VMfvsyEeaWp11bI5zR40AxO SmqZ1nUYR4g85pD5hbkGczt5q5VVEQvWbckzs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=brEz57KSv9M0lzRju932ZTp5uWTNGJMBeYQNt57q3B8=; b=uCgCpEEp1EPP6uQY8Um89CSaH+Hgpb35QC9u5j+6NVCHzBEkthMeHK+mPmZSkLT2w6 nl+wszEOmsJcaQLwmaZZyqY4rAPGwRsqvZ55peaHZSQq156jk7/L4r+CpTc5kdOWvxMc a1emGQPlmJ7DQbbf/BsTZBiJBAyArXmoVOrLw1+2m9YKVE2lZnn+D5iRgdq6wslST09q UNVb+DxJEYcfB99Ibf7CLrmhxniAdG2DX7GPoSCX/lb11PSdUaS26GUvhhOX4FycdqpO n5lY78Ijo4T8sjTLatSN5KWbBufkNgZDAQUTMEgm9hqyWmURgl0z2bygKAnCqDmwFKlL W5/A== X-Gm-Message-State: APjAAAVLEu/PcLsEC+K2ZMelxEMg3kFWXdzz0yLsWwwJTETlxD5jZAQB KoJMXvd1MegO7r62tKUD5XuAd59rt3LIGbbozkeVOPxWjG3y6GA1CVnhi7CGwDlZYMMHy9kxVrC +Wq5JrYxJ55DvqFS7dDMI0NuSHNYIiYFLkdpCn0kQnZpaNH993puY4oKE6HnPffUTakksXYF/iY 2vZ8UJkQ== X-Received: by 2002:a17:902:f24:: with SMTP id 33mr3626425ply.309.1566576609501; Fri, 23 Aug 2019 09:10:09 -0700 (PDT) Received: from [10.136.13.65] ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id a142sm3342737pfd.147.2019.08.23.09.10.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Aug 2019 09:10:08 -0700 (PDT) Subject: =?UTF-8?Q?Re=3a_=5bPATCH=5d_ethernet=3a_Delete_unnecessary_checks_b?= =?UTF-8?Q?efore_the_macro_call_=e2=80=9cdev=5fkfree=5fskb=e2=80=9d?= To: Christophe JAILLET , Markus Elfring , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, intel-wired-lan@lists.osuosl.org, bcm-kernel-feedback-list@broadcom.com, UNGLinuxDriver@microchip.com, Alexandre Torgue , Alexios Zavras , Allison Randal , Bryan Whitehead , Claudiu Manoil , "David S. Miller" , Doug Berger , Douglas Miller , Florian Fainelli , Giuseppe Cavallaro , Greg Kroah-Hartman , Jeff Kirsher , Jilayne Lovejoy , Jonathan Lemon , Jose Abreu , Kate Stewart Cc: kernel-janitors@vger.kernel.org, LKML References: <4ab7f2a5-f472-f462-9d4c-7c8d5237c44e@wanadoo.fr> From: Scott Branden Message-ID: Date: Fri, 23 Aug 2019 09:10:02 -0700 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: <4ab7f2a5-f472-f462-9d4c-7c8d5237c44e@wanadoo.fr> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-08-23 7:08 a.m., Christophe JAILLET wrote: > Hi, > > in this patch, there is one piece that looked better before. (see below) > > Removing the 'if (skb)' is fine, but concatening everything in one > statement just to save 2 variables and a few LOC is of no use, IMHO, > and the code is less readable. Agreed. > > just my 2c. > > > CJ > > > diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c > b/drivers/net/ethernet/broadcom/genet/bcmgenet.c > index d3a0b614dbfa..8b19ddcdafaa 100644 > --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c > +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c > @@ -2515,19 +2515,14 @@ static int bcmgenet_dma_teardown(struct > bcmgenet_priv *priv) >  static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) >  { >      struct netdev_queue *txq; > -    struct sk_buff *skb; > -    struct enet_cb *cb; >      int i; > >      bcmgenet_fini_rx_napi(priv); >      bcmgenet_fini_tx_napi(priv); > > -    for (i = 0; i < priv->num_tx_bds; i++) { > -        cb = priv->tx_cbs + i; > -        skb = bcmgenet_free_tx_cb(&priv->pdev->dev, cb); > -        if (skb) > -            dev_kfree_skb(skb); > -    } > +    for (i = 0; i < priv->num_tx_bds; i++) > + dev_kfree_skb(bcmgenet_free_tx_cb(&priv->pdev->dev, > +                          priv->tx_cbs + i)); > >      for (i = 0; i < priv->hw_params->tx_queues; i++) { >          txq = netdev_get_tx_queue(priv->dev, priv->tx_rings[i].queue);