Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4019583pxb; Mon, 8 Feb 2021 06:10:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4yw1Cdd+kwY04oyiBxiGOIWEDIzn9+VGIZEmzMMunqDYcpSrEBbeJ9sg5BuxA7UUNKlIq X-Received: by 2002:a17:906:3f96:: with SMTP id b22mr4742866ejj.478.1612793443059; Mon, 08 Feb 2021 06:10:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612793443; cv=none; d=google.com; s=arc-20160816; b=snM/AUGfyDEzNPAQQsQzkl755KzRY8k1Ty9cU90vefMffWu2wwd7kHwW6VxFzeR3Zs xZ9a2Dv95nAR6R9s9SfpxClMntk6/bgCdr9QUCKsx5uaBKPBNuFFgW0WBPvZeq/zQw9z JSCFGgdOvFW1s5NnA19rxJlyLuUBDzIrybWdxWEVk4ID8CoZidz8MDTUW+mUph200mnJ POFBLWYfDxokWeLfGPiW1O0a6AsILPlQ9gN4e+M1hwGj4CqUwXdQG8WWZU9/h+B0Mqt0 BSEXLzf5RjfMSH2pN+Tfw7xQH6Jmbj9IE3T7ai7l1VbdgO+oGkvgxQawQwV4XdGivfL+ iFaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=B8ZGd40Og2QAHRvuHIwRKzZ5U6xexdcHXeRE4SiqVuY=; b=J14iRYMwb3G/onuD95eHvp7wuIjhFLlk5ppa3cS8IVbzDS46mFZu+vHb8r9W+xP5mg W+Kd3ABHpCB4+ZHmqZJOaUMnGFbF6b7U43t+I5msqw1ib6J+3D6d0Y7vaReMbD49zzDh kPrn3Wmw658xVSCiBHfyXy25ak3GKge72wej7/vIsP1Behq6xH4ZjF2flWtcPhjAXd2w PY5Wr+vVmCzXw9T1T2O2pkRZnNhOwoqyzYkEkRr3tu2AyNq8BlRf5uDYPP73ph+39DW7 5kZz/KDT+P0xTvqT+lpOSyqD4P5h4e0k7wREmafEGl5B6N42dc/81BS3+HzgJPIbhxvn QW/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f16si7710474edx.512.2021.02.08.06.10.05; Mon, 08 Feb 2021 06:10:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231858AbhBHOJ1 (ORCPT + 99 others); Mon, 8 Feb 2021 09:09:27 -0500 Received: from mail.baikalelectronics.com ([87.245.175.226]:57074 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231876AbhBHN5s (ORCPT ); Mon, 8 Feb 2021 08:57:48 -0500 From: Serge Semin To: Rob Herring , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Johan Hovold , Maxime Ripard , Joao Pinto , Lars Persson , Maxime Coquelin CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , Vyacheslav Mitrofanov , , , , , Subject: [PATCH v2 12/24] net: stmmac: Directly call reverse methods in stmmac_probe_config_dt() Date: Mon, 8 Feb 2021 16:55:56 +0300 Message-ID: <20210208135609.7685-13-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208135609.7685-1-Sergey.Semin@baikalelectronics.ru> References: <20210208135609.7685-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Calling an antagonistic method from the corresponding protagonist isn't good from maintainability point of view, since prevents us from directly adding a functionality in the later, which needs to be reverted in the former. Since that's what we are about to do in order to fix the commit 573c0b9c4e0 ("stmmac: move stmmac_clk, pclk, clk_ptp_ref and stmmac_rst to platform structure"), let's replace the stmmac_remove_config_dt() method invocation in stmmac_probe_config_dt() with direct reversal procedures. Fixes: f573c0b9c4e0 ("stmmac: move stmmac_clk, pclk, clk_ptp_ref and stmmac_rst to platform structure") Signed-off-by: Serge Semin --- .../ethernet/stmicro/stmmac/stmmac_platform.c | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 1815fe36b62f..c9feac70ca77 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -402,7 +402,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) struct device_node *np = pdev->dev.of_node; struct plat_stmmacenet_data *plat; struct stmmac_dma_cfg *dma_cfg; - void *ret; int rc; plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); @@ -458,7 +457,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) /* To Configure PHY by using all device-tree supported properties */ rc = stmmac_dt_phy(plat, np, &pdev->dev); if (rc) - return ERR_PTR(rc); + goto error_dt_phy_parse; of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); @@ -536,8 +535,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg), GFP_KERNEL); if (!dma_cfg) { - stmmac_remove_config_dt(pdev, plat); - return ERR_PTR(-ENOMEM); + rc = -ENOMEM; + goto error_dma_cfg_alloc; } plat->dma_cfg = dma_cfg; @@ -564,10 +563,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) plat->axi = stmmac_axi_setup(pdev); rc = stmmac_mtl_setup(pdev, plat); - if (rc) { - stmmac_remove_config_dt(pdev, plat); - return ERR_PTR(rc); - } + if (rc) + goto error_dma_cfg_alloc; /* clock setup */ if (!of_device_is_compatible(np, "snps,dwc-qos-ethernet-4.10")) { @@ -582,7 +579,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) plat->pclk = devm_clk_get_optional(&pdev->dev, "pclk"); if (IS_ERR(plat->pclk)) { - ret = plat->pclk; + rc = PTR_ERR(plat->pclk); goto error_pclk_get; } clk_prepare_enable(plat->pclk); @@ -601,7 +598,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) plat->stmmac_rst = devm_reset_control_get_optional(&pdev->dev, STMMAC_RESOURCE_NAME); if (IS_ERR(plat->stmmac_rst)) { - ret = plat->stmmac_rst; + rc = PTR_ERR(plat->stmmac_rst); goto error_hw_init; } @@ -611,8 +608,12 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) clk_disable_unprepare(plat->pclk); error_pclk_get: clk_disable_unprepare(plat->stmmac_clk); +error_dma_cfg_alloc: + of_node_put(plat->mdio_node); +error_dt_phy_parse: + of_node_put(plat->phy_node); - return ret; + return ERR_PTR(rc); } /** -- 2.29.2