diff mbox series

[v2,2/2] net: stmmac: remove the unnecessary argument of stmmac_remove_config_dt()

Message ID 20241218032230.117453-3-joe@pf.is.s.u-tokyo.ac.jp (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: stmmac: fix an OF node reference leak in error paths in stmmac_probe_config_dt() | expand

Checks

Context Check Description
netdev/series_format warning Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 2 maintainers not CCed: linux-stm32@st-md-mailman.stormreply.com linux-arm-kernel@lists.infradead.org
netdev/build_clang success Errors and warnings before: 5 this patch: 5
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 65 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 28 this patch: 28
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-12-18--12-00 (tests: 877)

Commit Message

Joe Hattori Dec. 18, 2024, 3:22 a.m. UTC
The first argument of stmmac_remove_config_dt() is not used, so drop it.

Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
---
 .../ethernet/stmicro/stmmac/stmmac_platform.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

Comments

Dan Carpenter Dec. 18, 2024, 8:47 a.m. UTC | #1
On Wed, Dec 18, 2024 at 12:22:30PM +0900, Joe Hattori wrote:
>  static void devm_stmmac_remove_config_dt(void *data)
>  {
> -	struct plat_stmmacenet_data *plat = data;
> -
> -	/* Platform data argument is unused */
> -	stmmac_remove_config_dt(NULL, plat);
> +	stmmac_remove_config_dt(data);

Instead of doing this, move the code from stmmac_remove_config_dt()
to here and delete the stmmac_remove_config_dt() function.  Delete
the comments that mention stmmac_remove_config_dt().

- * Description: Devres variant of stmmac_probe_config_dt(). Does not require
- * the user to call stmmac_remove_config_dt() at driver detach.

This comment no longer makes sense.

regards,
dan carpenter
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 669d8eb07044..aadacb1d5939 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -407,13 +407,11 @@  static int stmmac_of_get_mac_mode(struct device_node *np)
 
 /**
  * stmmac_remove_config_dt - undo the effects of stmmac_probe_config_dt()
- * @pdev: platform_device structure
  * @plat: driver data platform structure
  *
  * Release resources claimed by stmmac_probe_config_dt().
  */
-static void stmmac_remove_config_dt(struct platform_device *pdev,
-				    struct plat_stmmacenet_data *plat)
+static void stmmac_remove_config_dt(struct plat_stmmacenet_data *plat)
 {
 	clk_disable_unprepare(plat->stmmac_clk);
 	clk_disable_unprepare(plat->pclk);
@@ -582,7 +580,7 @@  stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
 	dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
 			       GFP_KERNEL);
 	if (!dma_cfg) {
-		stmmac_remove_config_dt(pdev, plat);
+		stmmac_remove_config_dt(plat);
 		return ERR_PTR(-ENOMEM);
 	}
 	plat->dma_cfg = dma_cfg;
@@ -611,7 +609,7 @@  stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
 
 	rc = stmmac_mtl_setup(pdev, plat);
 	if (rc) {
-		stmmac_remove_config_dt(pdev, plat);
+		stmmac_remove_config_dt(plat);
 		return ERR_PTR(rc);
 	}
 
@@ -628,7 +626,7 @@  stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
 
 	plat->pclk = devm_clk_get_optional(&pdev->dev, "pclk");
 	if (IS_ERR(plat->pclk)) {
-		stmmac_remove_config_dt(pdev, plat);
+		stmmac_remove_config_dt(plat);
 		return ERR_CAST(plat->pclk);
 	}
 	clk_prepare_enable(plat->pclk);
@@ -647,14 +645,14 @@  stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
 	plat->stmmac_rst = devm_reset_control_get_optional(&pdev->dev,
 							   STMMAC_RESOURCE_NAME);
 	if (IS_ERR(plat->stmmac_rst)) {
-		stmmac_remove_config_dt(pdev, plat);
+		stmmac_remove_config_dt(plat);
 		return ERR_CAST(plat->stmmac_rst);
 	}
 
 	plat->stmmac_ahb_rst = devm_reset_control_get_optional_shared(
 							&pdev->dev, "ahb");
 	if (IS_ERR(plat->stmmac_ahb_rst)) {
-		stmmac_remove_config_dt(pdev, plat);
+		stmmac_remove_config_dt(plat);
 		return ERR_CAST(plat->stmmac_ahb_rst);
 	}
 
@@ -663,10 +661,7 @@  stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
 
 static void devm_stmmac_remove_config_dt(void *data)
 {
-	struct plat_stmmacenet_data *plat = data;
-
-	/* Platform data argument is unused */
-	stmmac_remove_config_dt(NULL, plat);
+	stmmac_remove_config_dt(data);
 }
 
 /**