RE: [PATCH] counter: rz-mtu3-cnt: put runtime PM ref if counter init fails

From: Cosmin-Gabriel Tanislav

Date: Fri Oct 30 2026 - 07:34:52 EST


> From: Li Youhong <dayou5941@xxxxxxx>
> Sent: Thursday, October 8, 2026 5:05 AM
>
> From: Li Youhong <liyouhong@xxxxxxxxxx>
>
> Counter enable takes a runtime PM reference before initialization but
> only puts it on disable. Drop the reference if initialization fails.
>
> Fixes: 0be8907359df ("counter: Add Renesas RZ/G2L MTU3a counter driver")
> Signed-off-by: Li Youhong <liyouhong@xxxxxxxxxx>

Missing Cc to stable.

Otherwise, this looks good.

Reviewed-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@xxxxxxxxxxx>

> ---
> drivers/counter/rz-mtu3-cnt.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/counter/rz-mtu3-cnt.c b/drivers/counter/rz-mtu3-cnt.c
> index 7bfb6979193c..61fbeb122851 100644
> --- a/drivers/counter/rz-mtu3-cnt.c
> +++ b/drivers/counter/rz-mtu3-cnt.c
> @@ -506,8 +506,11 @@ static int rz_mtu3_count_enable_write(struct counter_device *counter,
> if (enable) {
> pm_runtime_get_sync(counter->parent);
> ret = rz_mtu3_initialize_counter(counter, count->id);
> - if (ret == 0)
> - priv->count_is_enabled[count->id] = true;
> + if (ret < 0) {
> + pm_runtime_put(counter->parent);
> + goto exit;
> + }
> + priv->count_is_enabled[count->id] = true;
> } else {
> rz_mtu3_terminate_counter(counter, count->id);
> priv->count_is_enabled[count->id] = false;
> --
> 2.25.1
>