mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
pwm: atmel-tcb: Fix resource freeing in error path and remove
Several resources were not freed in the error path and the remove function. Add the forgotten items. Fixes:34cbcd7258("pwm: atmel-tcb: Add sama5d2 support") Fixes:061f8572a3("pwm: atmel-tcb: Switch to new binding") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
committed by
Thierry Reding
parent
0323e8fedd
commit
c11622324c
@@ -449,16 +449,20 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
|
|||||||
tcbpwm->clk = of_clk_get_by_name(np->parent, clk_name);
|
tcbpwm->clk = of_clk_get_by_name(np->parent, clk_name);
|
||||||
if (IS_ERR(tcbpwm->clk))
|
if (IS_ERR(tcbpwm->clk))
|
||||||
tcbpwm->clk = of_clk_get_by_name(np->parent, "t0_clk");
|
tcbpwm->clk = of_clk_get_by_name(np->parent, "t0_clk");
|
||||||
if (IS_ERR(tcbpwm->clk))
|
if (IS_ERR(tcbpwm->clk)) {
|
||||||
return PTR_ERR(tcbpwm->clk);
|
err = PTR_ERR(tcbpwm->clk);
|
||||||
|
goto err_slow_clk;
|
||||||
|
}
|
||||||
|
|
||||||
match = of_match_node(atmel_tcb_of_match, np->parent);
|
match = of_match_node(atmel_tcb_of_match, np->parent);
|
||||||
config = match->data;
|
config = match->data;
|
||||||
|
|
||||||
if (config->has_gclk) {
|
if (config->has_gclk) {
|
||||||
tcbpwm->gclk = of_clk_get_by_name(np->parent, "gclk");
|
tcbpwm->gclk = of_clk_get_by_name(np->parent, "gclk");
|
||||||
if (IS_ERR(tcbpwm->gclk))
|
if (IS_ERR(tcbpwm->gclk)) {
|
||||||
return PTR_ERR(tcbpwm->gclk);
|
err = PTR_ERR(tcbpwm->gclk);
|
||||||
|
goto err_clk;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tcbpwm->chip.dev = &pdev->dev;
|
tcbpwm->chip.dev = &pdev->dev;
|
||||||
@@ -469,7 +473,7 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
err = clk_prepare_enable(tcbpwm->slow_clk);
|
err = clk_prepare_enable(tcbpwm->slow_clk);
|
||||||
if (err)
|
if (err)
|
||||||
goto err_slow_clk;
|
goto err_gclk;
|
||||||
|
|
||||||
spin_lock_init(&tcbpwm->lock);
|
spin_lock_init(&tcbpwm->lock);
|
||||||
|
|
||||||
@@ -484,6 +488,12 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
|
|||||||
err_disable_clk:
|
err_disable_clk:
|
||||||
clk_disable_unprepare(tcbpwm->slow_clk);
|
clk_disable_unprepare(tcbpwm->slow_clk);
|
||||||
|
|
||||||
|
err_gclk:
|
||||||
|
clk_put(tcbpwm->gclk);
|
||||||
|
|
||||||
|
err_clk:
|
||||||
|
clk_put(tcbpwm->clk);
|
||||||
|
|
||||||
err_slow_clk:
|
err_slow_clk:
|
||||||
clk_put(tcbpwm->slow_clk);
|
clk_put(tcbpwm->slow_clk);
|
||||||
|
|
||||||
@@ -497,8 +507,9 @@ static void atmel_tcb_pwm_remove(struct platform_device *pdev)
|
|||||||
pwmchip_remove(&tcbpwm->chip);
|
pwmchip_remove(&tcbpwm->chip);
|
||||||
|
|
||||||
clk_disable_unprepare(tcbpwm->slow_clk);
|
clk_disable_unprepare(tcbpwm->slow_clk);
|
||||||
clk_put(tcbpwm->slow_clk);
|
clk_put(tcbpwm->gclk);
|
||||||
clk_put(tcbpwm->clk);
|
clk_put(tcbpwm->clk);
|
||||||
|
clk_put(tcbpwm->slow_clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct of_device_id atmel_tcb_pwm_dt_ids[] = {
|
static const struct of_device_id atmel_tcb_pwm_dt_ids[] = {
|
||||||
|
|||||||
Reference in New Issue
Block a user