diff mbox series

net: mv643xx_eth: undo some opreations in mv643xx_eth_probe

Message ID 20220315023019.2118163-1-chi.minghao@zte.com.cn (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: mv643xx_eth: undo some opreations in mv643xx_eth_probe | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 6 this patch: 6
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 6 this patch: 6
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 12 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

CGEL March 15, 2022, 2:30 a.m. UTC
From: Minghao Chi <chi.minghao@zte.com.cn>

Cannot directly return platform_get_irq return irq, there
are operations that need to be undone.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 drivers/net/ethernet/marvell/mv643xx_eth.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Andrew Lunn March 15, 2022, 8:26 p.m. UTC | #1
On Tue, Mar 15, 2022 at 02:30:19AM +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Cannot directly return platform_get_irq return irq, there
> are operations that need to be undone.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
>  drivers/net/ethernet/marvell/mv643xx_eth.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
> index e6cd4e214d79..6cd81737786e 100644
> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
> @@ -3189,8 +3189,11 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
>  
>  
>  	irq = platform_get_irq(pdev, 0);
> -	if (WARN_ON(irq < 0))
> +	if (WARN_ON(irq < 0)) {
> +		clk_disable_unprepare(mp->clk);
> +		free_netdev(dev);
>  		return irq;
> +	}

Isn't this where i said you should:

	goto out;

You need to set err first.

	Andrew
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index e6cd4e214d79..6cd81737786e 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -3189,8 +3189,11 @@  static int mv643xx_eth_probe(struct platform_device *pdev)
 
 
 	irq = platform_get_irq(pdev, 0);
-	if (WARN_ON(irq < 0))
+	if (WARN_ON(irq < 0)) {
+		clk_disable_unprepare(mp->clk);
+		free_netdev(dev);
 		return irq;
+	}
 	dev->irq = irq;
 
 	dev->netdev_ops = &mv643xx_eth_netdev_ops;