diff mbox series

[v3,5/7] pwm: rockchip: rockchip_pwm_probe(): Remove unneeded goto target

Message ID 0637b8ebea49b30e5e675385225d59d028077421.1608735481.git.simon@simonsouth.net (mailing list archive)
State New, archived
Headers show
Series pwm: rockchip: Eliminate potential race condition when probing | expand

Commit Message

Simon South Dec. 23, 2020, 4:01 p.m. UTC
Eliminate the remaining goto target in rockchip_pwm_probe() by moving the
code that follows it to the point where it is invoked.

The target no longer serves any purpose as the error-handling portions of
this function no longer share any recovery steps.

Signed-off-by: Simon South <simon@simonsouth.net>
---
 drivers/pwm/pwm-rockchip.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Uwe Kleine-K├Ânig Jan. 13, 2021, 7:38 a.m. UTC | #1
On Wed, Dec 23, 2020 at 11:01:07AM -0500, Simon South wrote:
> Eliminate the remaining goto target in rockchip_pwm_probe() by moving the
> code that follows it to the point where it is invoked.
> 
> The target no longer serves any purpose as the error-handling portions of
> this function no longer share any recovery steps.

If you adapt patch 4 as I suggested, this patch becomes obsolete.

Best regards
Uwe
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c
index d904a5d24885..80f5e69d9b8a 100644
--- a/drivers/pwm/pwm-rockchip.c
+++ b/drivers/pwm/pwm-rockchip.c
@@ -336,7 +336,8 @@  static int rockchip_pwm_probe(struct platform_device *pdev)
 	ret = clk_prepare_enable(pc->pclk);
 	if (ret) {
 		dev_err(&pdev->dev, "Can't enable APB clk: %d\n", ret);
-		goto err_clk;
+		clk_disable_unprepare(pc->clk);
+		return ret;
 	}
 
 	platform_set_drvdata(pdev, pc);
@@ -372,11 +373,6 @@  static int rockchip_pwm_probe(struct platform_device *pdev)
 	}
 
 	return 0;
-
-err_clk:
-	clk_disable_unprepare(pc->clk);
-
-	return ret;
 }
 
 static int rockchip_pwm_remove(struct platform_device *pdev)