From patchwork Sat Jun 28 00:10:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 4438951 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BE2859F2C8 for ; Sat, 28 Jun 2014 00:09:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5D762028D for ; Sat, 28 Jun 2014 00:09:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EE52E2018E for ; Sat, 28 Jun 2014 00:09:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751824AbaF1AJq (ORCPT ); Fri, 27 Jun 2014 20:09:46 -0400 Received: from mail-lb0-f175.google.com ([209.85.217.175]:54464 "EHLO mail-lb0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752799AbaF1AJo (ORCPT ); Fri, 27 Jun 2014 20:09:44 -0400 Received: by mail-lb0-f175.google.com with SMTP id n15so4409656lbi.20 for ; Fri, 27 Jun 2014 17:09:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:subject:cc:from:organization:date :mime-version:content-type:content-transfer-encoding:message-id; bh=hDpfRDbUPC6ZM/APxbRMlWEOSTiz20yJ44UbEUBJEC4=; b=UB8sO/TEYADgijMU21dcUW291ZVM8ujhp/dJCSPH/3DzsBYwdJ/AMhjIHzFGOi4UFo HM/NxPtDfclKwBmnxp4+kodS3/qfCP0WlBfE7cqc+oD0UlWAwN8TUW0dNkxoUCy5h+zB anPkBsNXIO7Vt8bc/kl7fBCkYioRN9ljxewhFp7ww97ArHWViazMObj6+F579yZCy6q0 LTo/gQiq8JBHF/wL0fUkBDbrLp7FtP5sT2+XaBTKbM0hdMZUNWD6Ca//9DcBdE9iptwn gNm7dRjVco/q39tpm9LyHTZarqNXh+c3l876pXPKyNc1JE9tsIY8cfz/AQnLkd2CSElC XOQA== X-Gm-Message-State: ALoCoQk37nEC21OYekhBpF6ybl1g/fAmTZ1MAx3+38i01m/GZfw/kJZBUC2cDZsdqOl2aoxRMbh3 X-Received: by 10.152.115.134 with SMTP id jo6mr18551449lab.6.1403914183404; Fri, 27 Jun 2014 17:09:43 -0700 (PDT) Received: from wasted.cogentembedded.com (ppp21-42.pppoe.mtu-net.ru. [81.195.21.42]) by mx.google.com with ESMTPSA id oq10sm8237394lbb.12.2014.06.27.17.09.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 27 Jun 2014 17:09:42 -0700 (PDT) To: netdev@vger.kernel.org Subject: [PATCH] sh_eth: remove checks around dev_kfree_skb() calls Cc: linux-sh@vger.kernel.org From: Sergei Shtylyov Organization: Cogent Embedded Date: Sat, 28 Jun 2014 04:10:00 +0400 MIME-Version: 1.0 Message-Id: <201406280410.01146.sergei.shtylyov@cogentembedded.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Since consume_skb() (and hence dev_kfree_skb() macro) checks the passed pointer for NULL, there's no need to check for NULL before invoking dev_kfree_skb(). Signed-off-by: Sergei Shtylyov --- The patch is against Dave Miller's 'net-next.git' repo. drivers/net/ethernet/renesas/sh_eth.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: net-next/drivers/net/ethernet/renesas/sh_eth.c =================================================================== --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c +++ net-next/drivers/net/ethernet/renesas/sh_eth.c @@ -1094,20 +1094,16 @@ static void sh_eth_ring_free(struct net_ /* Free Rx skb ringbuffer */ if (mdp->rx_skbuff) { - for (i = 0; i < mdp->num_rx_ring; i++) { - if (mdp->rx_skbuff[i]) - dev_kfree_skb(mdp->rx_skbuff[i]); - } + for (i = 0; i < mdp->num_rx_ring; i++) + dev_kfree_skb(mdp->rx_skbuff[i]); } kfree(mdp->rx_skbuff); mdp->rx_skbuff = NULL; /* Free Tx skb ringbuffer */ if (mdp->tx_skbuff) { - for (i = 0; i < mdp->num_tx_ring; i++) { - if (mdp->tx_skbuff[i]) - dev_kfree_skb(mdp->tx_skbuff[i]); - } + for (i = 0; i < mdp->num_tx_ring; i++) + dev_kfree_skb(mdp->tx_skbuff[i]); } kfree(mdp->tx_skbuff); mdp->tx_skbuff = NULL; @@ -2077,13 +2073,11 @@ static void sh_eth_tx_timeout(struct net rxdesc = &mdp->rx_ring[i]; rxdesc->status = 0; rxdesc->addr = 0xBADF00D0; - if (mdp->rx_skbuff[i]) - dev_kfree_skb(mdp->rx_skbuff[i]); + dev_kfree_skb(mdp->rx_skbuff[i]); mdp->rx_skbuff[i] = NULL; } for (i = 0; i < mdp->num_tx_ring; i++) { - if (mdp->tx_skbuff[i]) - dev_kfree_skb(mdp->tx_skbuff[i]); + dev_kfree_skb(mdp->tx_skbuff[i]); mdp->tx_skbuff[i] = NULL; }