diff mbox series

[11/40] mfd: ti_am335x_tscadc: Get rid of useless gotos

Message ID 20210825152518.379386-12-miquel.raynal@bootlin.com
State New
Headers show
Series TI AM437X ADC1 | expand

Commit Message

Miquel Raynal Aug. 25, 2021, 3:24 p.m. UTC
Gotos jumping to a return statement are not really useful, drop them.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mfd/ti_am335x_tscadc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Jonathan Cameron Aug. 30, 2021, 1:39 p.m. UTC | #1
On Wed, 25 Aug 2021 17:24:49 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Gotos jumping to a return statement are not really useful, drop them.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

As a side note, I'm not seeing the expected calls to of_put_node() for
the child nodes.  So we are leaking some stuff on those calls.

Fixing that might make this patch no longer correct.

> ---
>  drivers/mfd/ti_am335x_tscadc.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
> index f0824732badf..8e86b766b619 100644
> --- a/drivers/mfd/ti_am335x_tscadc.c
> +++ b/drivers/mfd/ti_am335x_tscadc.c
> @@ -169,7 +169,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
>  	err = platform_get_irq(pdev, 0);
>  	if (err < 0) {
>  		dev_err(&pdev->dev, "no irq ID is specified.\n");
> -		goto ret;
> +		return err;
>  	} else {
>  		tscadc->irq = err;
>  	}
> @@ -185,8 +185,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
>  					       &tscadc_regmap_config);
>  	if (IS_ERR(tscadc->regmap)) {
>  		dev_err(&pdev->dev, "regmap init failed\n");
> -		err = PTR_ERR(tscadc->regmap);
> -		goto ret;
> +		return PTR_ERR(tscadc->regmap);
>  	}
>  
>  	spin_lock_init(&tscadc->reg_lock);
> @@ -270,7 +269,7 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
>  err_disable_clk:
>  	pm_runtime_put_sync(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
> -ret:
> +
>  	return err;
>  }
>
diff mbox series

Patch

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index f0824732badf..8e86b766b619 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -169,7 +169,7 @@  static	int ti_tscadc_probe(struct platform_device *pdev)
 	err = platform_get_irq(pdev, 0);
 	if (err < 0) {
 		dev_err(&pdev->dev, "no irq ID is specified.\n");
-		goto ret;
+		return err;
 	} else {
 		tscadc->irq = err;
 	}
@@ -185,8 +185,7 @@  static	int ti_tscadc_probe(struct platform_device *pdev)
 					       &tscadc_regmap_config);
 	if (IS_ERR(tscadc->regmap)) {
 		dev_err(&pdev->dev, "regmap init failed\n");
-		err = PTR_ERR(tscadc->regmap);
-		goto ret;
+		return PTR_ERR(tscadc->regmap);
 	}
 
 	spin_lock_init(&tscadc->reg_lock);
@@ -270,7 +269,7 @@  static	int ti_tscadc_probe(struct platform_device *pdev)
 err_disable_clk:
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
-ret:
+
 	return err;
 }