diff mbox series

[net-next,02/11] net: stmmac: dwmac-visconti: Make visconti_eth_clock_remove() return void

Message ID 20230402143025.2524443-3-u.kleine-koenig@pengutronix.de (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: stmmac: Convert to platform remove callback returning void | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
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 fail Errors and warnings before: 18 this patch: 19
netdev/cc_maintainers success CCed 12 of 12 maintainers
netdev/build_clang fail Errors and warnings before: 18 this patch: 21
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 fail Errors and warnings before: 18 this patch: 19
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 26 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Uwe Kleine-König April 2, 2023, 2:30 p.m. UTC
The function returns zero unconditionally. Change it to return void
instead which simplifies one caller as error handing becomes
unnecessary.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Simon Horman April 2, 2023, 5:02 p.m. UTC | #1
On Sun, Apr 02, 2023 at 04:30:16PM +0200, Uwe Kleine-König wrote:
> The function returns zero unconditionally. Change it to return void
> instead which simplifies one caller as error handing becomes
> unnecessary.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

...

> @@ -267,9 +265,7 @@ static int visconti_eth_dwmac_remove(struct platform_device *pdev)
>  
>  	stmmac_pltfr_remove(pdev);
>  
> -	err = visconti_eth_clock_remove(pdev);
> -	if (err < 0)
> -		dev_err(&pdev->dev, "failed to remove clock: %d\n", err);
> +	visconti_eth_clock_remove(pdev);
>  
>  	stmmac_remove_config_dt(pdev, priv->plat);

err is now returned uninitialised by this function.

I see that err is removed in a later patch.
But perhaps it's best to make this patch clean in this regard too.
Uwe Kleine-König April 3, 2023, 5:52 a.m. UTC | #2
Hello Simon,

On Sun, Apr 02, 2023 at 07:02:26PM +0200, Simon Horman wrote:
> On Sun, Apr 02, 2023 at 04:30:16PM +0200, Uwe Kleine-König wrote:
> > The function returns zero unconditionally. Change it to return void
> > instead which simplifies one caller as error handing becomes
> > unnecessary.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> ...
> 
> > @@ -267,9 +265,7 @@ static int visconti_eth_dwmac_remove(struct platform_device *pdev)
> >  
> >  	stmmac_pltfr_remove(pdev);
> >  
> > -	err = visconti_eth_clock_remove(pdev);
> > -	if (err < 0)
> > -		dev_err(&pdev->dev, "failed to remove clock: %d\n", err);
> > +	visconti_eth_clock_remove(pdev);
> >  
> >  	stmmac_remove_config_dt(pdev, priv->plat);
> 
> err is now returned uninitialised by this function.

Good catch. Indeed err must be removed in this patch and return err
replaced by return 0. I'll send a v2 later this week, waiting a bit for
further feedback.

Best regards
Uwe
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
index d43da71eb1e1..7531fcd4ffe2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
@@ -198,7 +198,7 @@  static int visconti_eth_clock_probe(struct platform_device *pdev,
 	return 0;
 }
 
-static int visconti_eth_clock_remove(struct platform_device *pdev)
+static void visconti_eth_clock_remove(struct platform_device *pdev)
 {
 	struct visconti_eth *dwmac = get_stmmac_bsp_priv(&pdev->dev);
 	struct net_device *ndev = platform_get_drvdata(pdev);
@@ -206,8 +206,6 @@  static int visconti_eth_clock_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(dwmac->phy_ref_clk);
 	clk_disable_unprepare(priv->plat->stmmac_clk);
-
-	return 0;
 }
 
 static int visconti_eth_dwmac_probe(struct platform_device *pdev)
@@ -267,9 +265,7 @@  static int visconti_eth_dwmac_remove(struct platform_device *pdev)
 
 	stmmac_pltfr_remove(pdev);
 
-	err = visconti_eth_clock_remove(pdev);
-	if (err < 0)
-		dev_err(&pdev->dev, "failed to remove clock: %d\n", err);
+	visconti_eth_clock_remove(pdev);
 
 	stmmac_remove_config_dt(pdev, priv->plat);