RE: [PATCH v3 14/14] counter: rz-mtu3-cnt: use pm_runtime_resume_and_get()

From: Biju Das

Date: Tue Nov 17 2026 - 12:04:40 EST




> -----Original Message-----
> From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@xxxxxxxxxxx>
> Sent: 17 November 2026 10:26
> Subject: [PATCH v3 14/14] counter: rz-mtu3-cnt: use pm_runtime_resume_and_get()
>
> pm_runtime_get_sync() may increment the runtime PM usage count even if the resume fails, which
> requires an explicit pm_runtime_put_noidle() to balance it.
>
> This driver ignores the return value of pm_runtime_get_sync(), risking accessing device registers even
> if resume failed.
>
> Replace it with pm_runtime_resume_and_get() and handle errors properly.
>
> Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@xxxxxxxxxxx>


Maybe fixes tag as it fixes a kernel crash in case of error??

Reviewed-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>

> ---
>
> V3:
> * no changes
>
> V2:
> * no changes
>
> drivers/counter/rz-mtu3-cnt.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/counter/rz-mtu3-cnt.c b/drivers/counter/rz-mtu3-cnt.c index
> 8252dee6d04d..1426d15f0ccc 100644
> --- a/drivers/counter/rz-mtu3-cnt.c
> +++ b/drivers/counter/rz-mtu3-cnt.c
> @@ -435,7 +435,10 @@ static int rz_mtu3_count_enable_write(struct counter_device *counter,
> return 0;
>
> if (enable) {
> - pm_runtime_get_sync(counter->parent);
> + ret = pm_runtime_resume_and_get(counter->parent);
> + if (ret)
> + return ret;
> +
> ret = rz_mtu3_initialize_counter(counter, count->id);
> if (ret < 0) {
> pm_runtime_put(counter->parent);
> --
> 2.56.0