From patchwork Tue Nov 3 21:17:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 7547201 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DC902BEEA4 for ; Tue, 3 Nov 2015 21:17:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0529020788 for ; Tue, 3 Nov 2015 21:17:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EFDE420524 for ; Tue, 3 Nov 2015 21:17:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755772AbbKCVRN (ORCPT ); Tue, 3 Nov 2015 16:17:13 -0500 Received: from mail-lf0-f53.google.com ([209.85.215.53]:33434 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755304AbbKCVRM (ORCPT ); Tue, 3 Nov 2015 16:17:12 -0500 Received: by lfbf136 with SMTP id f136so31486917lfb.0 for ; Tue, 03 Nov 2015 13:17:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded_com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :mime-version:content-transfer-encoding:content-type; bh=sJIeUBj0wDLLwZ4YTRDw5BOFnFihMB9Pw+uWCsDzQ0o=; b=l+s38E/fXTCX/4BhuDeaCEA9i2/QFYph3NoY7qFwaWNMY3RJVG8c6doihxKfxV+zZJ Jb83jK0Gi8/6OD2W3r6A0lISi27JM6QBW6DlnUfV9lOUKRHZ+eOd8n8pLDz4dXt0ILuk rxGCnEKCdzDatv5Bzs1dEpsnBtx+WDIMfP5BFFptcetyS3wzcDzfmtqJ4REUnuZ1voy8 5dc306lSuuJbGuC4n9hE950vPAOCK/cuyulKdY8onUjyK8eEXWG435z4n9rRF4WSq2rU luqoRh+bIsU82bsJGNKXzzM0bJtLAzJUndvaDdqTL77pgpIFU9wo7cb4WIHTdsSMUi9K oKFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:mime-version:content-transfer-encoding:content-type; bh=sJIeUBj0wDLLwZ4YTRDw5BOFnFihMB9Pw+uWCsDzQ0o=; b=NjGxlRImw4mDUQvVJotsKbLy7jK52NbBwUjgzZctU1DD0HVO2DZL1dwqJZ5kWPRWuH Ol9d9e34TjbDCcG+WSa9kbF2RRsLr9rb3X56BWEQmtOMnzdki4Fkru9hthv1Ai3iC2Jq tw/dtaY2O+qpR4HlkC9GgfmqmI0Fz/P3Ps0rPBu1rlgvDeWxzjMGAWx/3owZFtyIJsu9 WGFt52Dlu7aBHM2cYyqQxGWXzokryURWZiuSFSifeCLH8gWBzTkeD6HFbSooYYHb17TV GG1KwMLI8ZssHXdJh9/ou9mKxb+5YpgqJlSfdQHTbfsDZtNM8amiP0bYSfSfEpaGmaFD 7oBA== X-Gm-Message-State: ALoCoQmVWm46UgWE+8DXULavTuYaz5wDXAexINytgIlaw2Hzs7aISL7S6uNX+rpHWk/fmdOkLfFt X-Received: by 10.25.156.5 with SMTP id f5mr9442590lfe.46.1446585430664; Tue, 03 Nov 2015 13:17:10 -0800 (PST) Received: from wasted.cogentembedded.com ([31.173.80.192]) by smtp.gmail.com with ESMTPSA id m80sm5169257lfm.15.2015.11.03.13.17.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2015 13:17:09 -0800 (PST) From: Sergei Shtylyov To: netdev@vger.kernel.org Cc: linux-sh@vger.kernel.org Subject: [PATCH] sh_eth: kill 'ret' variable in sh_eth_ring_init() Date: Wed, 04 Nov 2015 00:17:08 +0300 Message-ID: <3103690.zc6n37veWQ@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.9 (Linux/4.2.3-200.fc22.x86_64; KDE/4.14.11; x86_64; ; ) MIME-Version: 1.0 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,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 The 'ret' local variable in sh_eth_ring_init() serves no useful purpose as the only values it gets assigned are 0 and -ENOMEM both of which could be returned directly... Signed-off-by: Sergei Shtylyov --- The patch is against DaveM's 'net-next.git' repo. drivers/net/ethernet/renesas/sh_eth.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 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 @@ -1199,7 +1199,7 @@ static void sh_eth_ring_format(struct ne static int sh_eth_ring_init(struct net_device *ndev) { struct sh_eth_private *mdp = netdev_priv(ndev); - int rx_ringsize, tx_ringsize, ret = 0; + int rx_ringsize, tx_ringsize; /* +26 gets the maximum ethernet encapsulation, +7 & ~7 because the * card needs room to do 8 byte alignment, +2 so we can reserve @@ -1214,26 +1214,20 @@ static int sh_eth_ring_init(struct net_d /* Allocate RX and TX skb rings */ mdp->rx_skbuff = kcalloc(mdp->num_rx_ring, sizeof(*mdp->rx_skbuff), GFP_KERNEL); - if (!mdp->rx_skbuff) { - ret = -ENOMEM; - return ret; - } + if (!mdp->rx_skbuff) + return -ENOMEM; mdp->tx_skbuff = kcalloc(mdp->num_tx_ring, sizeof(*mdp->tx_skbuff), GFP_KERNEL); - if (!mdp->tx_skbuff) { - ret = -ENOMEM; + if (!mdp->tx_skbuff) goto skb_ring_free; - } /* Allocate all Rx descriptors. */ rx_ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring; mdp->rx_ring = dma_alloc_coherent(NULL, rx_ringsize, &mdp->rx_desc_dma, GFP_KERNEL); - if (!mdp->rx_ring) { - ret = -ENOMEM; + if (!mdp->rx_ring) goto skb_ring_free; - } mdp->dirty_rx = 0; @@ -1241,11 +1235,9 @@ static int sh_eth_ring_init(struct net_d tx_ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring; mdp->tx_ring = dma_alloc_coherent(NULL, tx_ringsize, &mdp->tx_desc_dma, GFP_KERNEL); - if (!mdp->tx_ring) { - ret = -ENOMEM; + if (!mdp->tx_ring) goto desc_ring_free; - } - return ret; + return 0; desc_ring_free: /* free DMA buffer */ @@ -1257,7 +1249,7 @@ skb_ring_free: mdp->tx_ring = NULL; mdp->rx_ring = NULL; - return ret; + return -ENOMEM; } static void sh_eth_free_dma_buffer(struct sh_eth_private *mdp)