Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753151AbcLHKom (ORCPT ); Thu, 8 Dec 2016 05:44:42 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:9618 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750982AbcLHKok (ORCPT ); Thu, 8 Dec 2016 05:44:40 -0500 Subject: Re: [PATCH v3 1/6] net: stmmac: return error if no DMA configuration is found To: Niklas Cassel , Giuseppe Cavallaro References: <1481120409-18103-1-git-send-email-niklass@axis.com> <1481120409-18103-2-git-send-email-niklass@axis.com> CC: Niklas Cassel , , From: Alexandre Torgue Message-ID: Date: Thu, 8 Dec 2016 11:44:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1481120409-18103-2-git-send-email-niklass@axis.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.48.0.2] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-08_05:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2229 Lines: 62 Hi Niklas, On 12/07/2016 03:20 PM, Niklas Cassel wrote: > From: Niklas Cassel > > All drivers except pci glue layer calls stmmac_probe_config_dt. > stmmac_probe_config_dt does a kzalloc dma_cfg. > > pci glue layer does kzalloc dma_cfg explicitly, so all current > drivers does a kzalloc dma_cfg. > > Return an error if no DMA configuration is found, that way > we can assume that the DMA configuration always exists. > > Signed-off-by: Niklas Cassel Acked-by: Alexandre Torgue > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 982c95213da4..14366800e5e6 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -1578,16 +1578,12 @@ static void stmmac_check_ether_addr(struct stmmac_priv *priv) > */ > static int stmmac_init_dma_engine(struct stmmac_priv *priv) > { > - int pbl = DEFAULT_DMA_PBL, fixed_burst = 0, aal = 0; > - int mixed_burst = 0; > int atds = 0; > int ret = 0; > > - if (priv->plat->dma_cfg) { > - pbl = priv->plat->dma_cfg->pbl; > - fixed_burst = priv->plat->dma_cfg->fixed_burst; > - mixed_burst = priv->plat->dma_cfg->mixed_burst; > - aal = priv->plat->dma_cfg->aal; > + if (!priv->plat->dma_cfg) { > + dev_err(priv->device, "DMA configuration not found\n"); > + return -EINVAL; > } > > if (priv->extend_desc && (priv->mode == STMMAC_RING_MODE)) > @@ -1599,8 +1595,12 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv) > return ret; > } > > - priv->hw->dma->init(priv->ioaddr, pbl, fixed_burst, mixed_burst, > - aal, priv->dma_tx_phy, priv->dma_rx_phy, atds); > + priv->hw->dma->init(priv->ioaddr, > + priv->plat->dma_cfg->pbl, > + priv->plat->dma_cfg->fixed_burst, > + priv->plat->dma_cfg->mixed_burst, > + priv->plat->dma_cfg->aal, > + priv->dma_tx_phy, priv->dma_rx_phy, atds); > > if (priv->synopsys_id >= DWMAC_CORE_4_00) { > priv->rx_tail_addr = priv->dma_rx_phy + >