From: claudiu beznea <claudiu.beznea@tuxon.dev>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Nicolas Ferre" <nicolas.ferre@microchip.com>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Cc: linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
kernel@pengutronix.de
Subject: Re: [PATCH 2/5] pwm: atmel-tcb: Fix resource freeing in error path and remove
Date: Thu, 27 Jul 2023 09:00:05 +0300 [thread overview]
Message-ID: <21d8c545-2872-3fcc-44fc-3106d4b8def8@tuxon.dev> (raw)
In-Reply-To: <20230719192013.4051193-3-u.kleine-koenig@pengutronix.de>
On 19.07.2023 22:20, Uwe Kleine-König wrote:
> Several resources were not freed in the error path and the remove
> function. Add the forgotten items.
>
> Fixes: 34cbcd72588f ("pwm: atmel-tcb: Add sama5d2 support")
> Fixes: 061f8572a31c ("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>
> ---
> drivers/pwm/pwm-atmel-tcb.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
> index 613dd1810fb5..2826fc216d29 100644
> --- a/drivers/pwm/pwm-atmel-tcb.c
> +++ b/drivers/pwm/pwm-atmel-tcb.c
> @@ -450,16 +450,20 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
> tcbpwm->clk = of_clk_get_by_name(np->parent, clk_name);
> if (IS_ERR(tcbpwm->clk))
> tcbpwm->clk = of_clk_get_by_name(np->parent, "t0_clk");
> - if (IS_ERR(tcbpwm->clk))
> - return PTR_ERR(tcbpwm->clk);
> + if (IS_ERR(tcbpwm->clk)) {
> + err = PTR_ERR(tcbpwm->clk);
> + goto err_slow_clk;
> + }
>
> match = of_match_node(atmel_tcb_of_match, np->parent);
> config = match->data;
>
> if (config->has_gclk) {
> tcbpwm->gclk = of_clk_get_by_name(np->parent, "gclk");
> - if (IS_ERR(tcbpwm->gclk))
> - return PTR_ERR(tcbpwm->gclk);
> + if (IS_ERR(tcbpwm->gclk)) {
> + err = PTR_ERR(tcbpwm->gclk);
> + goto err_clk;
> + }
> }
>
> tcbpwm->chip.dev = &pdev->dev;
> @@ -470,7 +474,7 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
>
> err = clk_prepare_enable(tcbpwm->slow_clk);
> if (err)
> - goto err_slow_clk;
> + goto err_gclk;
>
> spin_lock_init(&tcbpwm->lock);
>
> @@ -485,6 +489,12 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
> err_disable_clk:
> clk_disable_unprepare(tcbpwm->slow_clk);
>
> +err_gclk:
> + clk_put(tcbpwm->gclk);
> +
> +err_clk:
> + clk_put(tcbpwm->clk);
> +
> err_slow_clk:
> clk_put(tcbpwm->slow_clk);
>
> @@ -498,8 +508,9 @@ static void atmel_tcb_pwm_remove(struct platform_device *pdev)
> pwmchip_remove(&tcbpwm->chip);
>
> clk_disable_unprepare(tcbpwm->slow_clk);
> - clk_put(tcbpwm->slow_clk);
> + clk_put(tcbpwm->gclk);
> clk_put(tcbpwm->clk);
> + clk_put(tcbpwm->slow_clk);
> }
>
> static const struct of_device_id atmel_tcb_pwm_dt_ids[] = {
next prev parent reply other threads:[~2023-07-27 6:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-19 19:20 [PATCH 0/5] pwm: atmel-tcb: Some driver maintenance Uwe Kleine-König
2023-07-19 19:20 ` [PATCH 1/5] pwm: atmel-tcb: Harmonize resource allocation order Uwe Kleine-König
2023-07-27 6:00 ` claudiu beznea
2023-07-27 7:00 ` Uwe Kleine-König
2023-07-19 19:20 ` [PATCH 2/5] pwm: atmel-tcb: Fix resource freeing in error path and remove Uwe Kleine-König
2023-07-27 6:00 ` claudiu beznea [this message]
2023-07-19 19:20 ` [PATCH 3/5] pwm: atmel-tcb: Put per-channel data into driver data Uwe Kleine-König
2023-07-27 5:59 ` claudiu beznea
2023-07-19 19:20 ` [PATCH 4/5] pwm: atmel-tcb: Unroll atmel_tcb_pwm_set_polarity() into only caller Uwe Kleine-König
2023-07-27 5:59 ` claudiu beznea
2023-07-19 19:20 ` [PATCH 5/5] pwm: atmel-tcb: Don't track polarity in driver data Uwe Kleine-König
2023-07-27 5:59 ` claudiu beznea
2023-07-28 7:36 ` [PATCH 0/5] pwm: atmel-tcb: Some driver maintenance Thierry Reding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=21d8c545-2872-3fcc-44fc-3106d4b8def8@tuxon.dev \
--to=claudiu.beznea@tuxon.dev \
--cc=alexandre.belloni@bootlin.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pwm@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox