Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753242AbdGJGXG (ORCPT ); Mon, 10 Jul 2017 02:23:06 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:52629 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752707AbdGJGXD (ORCPT ); Mon, 10 Jul 2017 02:23:03 -0400 Subject: Re: [PATCH 3/3] net: stmmac: Make 'alloc_dma_[rt]x_desc_resources()' look even closer To: Christophe JAILLET , References: CC: , , From: Giuseppe CAVALLARO Message-ID: <68a04948-2a52-56d4-1875-d15540808eed@st.com> Date: Mon, 10 Jul 2017 08:22:50 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG4NODE3.st.com (10.75.127.12) To SFHDAG4NODE1.st.com (10.75.127.10) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-10_03:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2318 Lines: 68 On 7/8/2017 9:46 AM, Christophe JAILLET wrote: > 'alloc_dma_[rt]x_desc_resources()' functions look very close. > Remove a useless initialization and use the same label name for error > handling path in order to get them even closer. > > Signed-off-by: Christophe JAILLET Acked-by: Giuseppe Cavallaro > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 07d486a70118..1853f7ff6657 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -1449,7 +1449,7 @@ static void free_dma_rx_desc_resources(struct stmmac_priv *priv) > static void free_dma_tx_desc_resources(struct stmmac_priv *priv) > { > u32 tx_count = priv->plat->tx_queues_to_use; > - u32 queue = 0; > + u32 queue; > > /* Free TX queue resources */ > for (queue = 0; queue < tx_count; queue++) { > @@ -1561,13 +1561,13 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv) > sizeof(*tx_q->tx_skbuff_dma), > GFP_KERNEL); > if (!tx_q->tx_skbuff_dma) > - goto err_dma_buffers; > + goto err_dma; > > tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE, > sizeof(struct sk_buff *), > GFP_KERNEL); > if (!tx_q->tx_skbuff) > - goto err_dma_buffers; > + goto err_dma; > > if (priv->extend_desc) { > tx_q->dma_etx = dma_zalloc_coherent(priv->device, > @@ -1577,7 +1577,7 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv) > &tx_q->dma_tx_phy, > GFP_KERNEL); > if (!tx_q->dma_etx) > - goto err_dma_buffers; > + goto err_dma; > } else { > tx_q->dma_tx = dma_zalloc_coherent(priv->device, > DMA_TX_SIZE * > @@ -1586,13 +1586,13 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv) > &tx_q->dma_tx_phy, > GFP_KERNEL); > if (!tx_q->dma_tx) > - goto err_dma_buffers; > + goto err_dma; > } > } > > return 0; > > -err_dma_buffers: > +err_dma: > free_dma_tx_desc_resources(priv); > > return ret;