Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3094416rdb; Tue, 29 Aug 2023 05:25:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBgGHpa6FmQydo004A4pKZdRfikqYsYoDVL18L/ZMQJL7d7XuuHI6zEuEqPCfnLm2FbKEe X-Received: by 2002:a05:6a20:432b:b0:13a:12c2:359e with SMTP id h43-20020a056a20432b00b0013a12c2359emr26640642pzk.2.1693311948975; Tue, 29 Aug 2023 05:25:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693311948; cv=none; d=google.com; s=arc-20160816; b=E95vqbyjBhmVXBQCEo32a8jKcSk3z217vN/8wW5WAh0kMqbyMjST/ftsXNKuNB6teM qb1Gx5tpFW84+2RoGXoFS0JKGSraOAbzlj0/YKOv/6TsVjzSUgzkCqRijqByq43VuFiS r/ONzQpwLNJaElHc7+MywTcpnPfLmqEwV4XtIIW5V0OGPqEjw24WmwyV/7JUzjr0pmTK x4uSCOgFyVrh1Pl0Ryd8yGBqEAmcfe5RmNvSXBBoX2vjdwg5kbPsZWaaimWJRrMGuUts kxlvHi8YAw78GRN5E7x4IANgYC5ENbeJ4btBYT/qACblLv0DQ3l7A9e1WbvL9faaUeI6 re9w== 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 :dkim-signature; bh=Xy+m2mPCvfigWK8CGRPydrmGk3j5ZCy+C6IVghdSvzs=; fh=r/VVG12KmrF+nQv7lC2x2sQ0qQnFs7bJUsMqdUzXKDU=; b=T/PL0raJnwHCenl3ZDYeY4/Cvz2ihbU/r2BbzaiK6uNPCNWNn3Ylap6gTP7snBq4o7 QJod3zXw+JzLyHUDC+h9zNgy7KPYJTCKfbGzc9pxemmyuSssg8qLD8LcKZnSudvaud7/ 1m7piZjaG4+ZtdIEknzDSpjINhOgOlBqCrsSj8pvs2gKf8zWjaCdq2qCuLWibMY4u356 kmQZdpesgRt2mzDtUQG5Q7V08jijmZQnnOnTNMFQBLMwGwYzyRFmTfqv7LlEs2hO9dGB XfN+0upOHjcevQXaQhPBVuHHWx23HJvt2gzKNKUjJonFudb5fzo00HQ1LePB07YyC9Ir VTIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NKMvejOV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ca23-20020a056a00419700b006826f3512f1si1550275pfb.204.2023.08.29.05.25.29; Tue, 29 Aug 2023 05:25:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NKMvejOV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235299AbjH2Kzn (ORCPT + 99 others); Tue, 29 Aug 2023 06:55:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235364AbjH2KzZ (ORCPT ); Tue, 29 Aug 2023 06:55:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3139F1B7 for ; Tue, 29 Aug 2023 03:54:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 61F22654B7 for ; Tue, 29 Aug 2023 10:54:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 060FAC433C7; Tue, 29 Aug 2023 10:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693306463; bh=6nCILmacmIccYtgXTE19gVmX2P5pq+VSU/q00ww6xVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NKMvejOVQzNvMY2e93hkV80IHU1WHDa9CV+dqb5VnfbKNuUKrEMzLB4uOGB2SQzpC 85qAeuQSqF8U6R3+lmXoTByAQESpJon8YswKLOAvII8sNMqg+layFi5ztj+B/YNQoa MhIg59lBdg9wD1R5yNjNz8N3FVV1oZ9DFe95NUOvXHBA5jXwI+x5onYzwYbiU9LWFW yBWGOHUcjBG8ufUrJSp1/Qwi9A/xSOMsu4wjpRNha/N0TOsEeJOXKtW/SsJCjbT/fl TT7tEAHwo3avaY3ofdt54GTsSEHHCQ6S58yO+tZplSA+BTZX3vUJlK3TBIsIE2q7Ey JCHZrXJjyn0wA== From: Jisheng Zhang To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Vladimir Zapolskiy , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Emil Renner Berthing , Samin Guo , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Jonathan Hunter , Nobuhiro Iwamatsu , Russell King , Matthias Brugger , AngeloGioacchino Del Regno , Bartosz Golaszewski Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 17/22] net: stmmac: dwmac-stm32: use devm_stmmac_probe_config_dt() Date: Tue, 29 Aug 2023 18:40:28 +0800 Message-Id: <20230829104033.955-18-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230829104033.955-1-jszhang@kernel.org> References: <20230829104033.955-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Simplify the driver's probe() function by using the devres variant of stmmac_probe_config_dt(). Signed-off-by: Jisheng Zhang --- .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c index 3a09085819dc..7214a1b11b34 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c @@ -370,21 +370,18 @@ static int stm32_dwmac_probe(struct platform_device *pdev) if (ret) return ret; - plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); - if (!dwmac) { - ret = -ENOMEM; - goto err_remove_config_dt; - } + if (!dwmac) + return -ENOMEM; data = of_device_get_match_data(&pdev->dev); if (!data) { dev_err(&pdev->dev, "no of match data provided\n"); - ret = -EINVAL; - goto err_remove_config_dt; + return -EINVAL; } dwmac->ops = data; @@ -393,14 +390,14 @@ static int stm32_dwmac_probe(struct platform_device *pdev) ret = stm32_dwmac_parse_data(dwmac, &pdev->dev); if (ret) { dev_err(&pdev->dev, "Unable to parse OF data\n"); - goto err_remove_config_dt; + return ret; } plat_dat->bsp_priv = dwmac; ret = stm32_dwmac_init(plat_dat); if (ret) - goto err_remove_config_dt; + return ret; ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); if (ret) @@ -410,8 +407,6 @@ static int stm32_dwmac_probe(struct platform_device *pdev) err_clk_disable: stm32_dwmac_clk_disable(dwmac); -err_remove_config_dt: - stmmac_remove_config_dt(pdev, plat_dat); return ret; } -- 2.40.1