All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Cosmin Tanislav" <cosmin-gabriel.tanislav.xa@renesas.com>
Cc: robh@kernel.org, conor+dt@kernel.org,
	wsa+renesas@sang-engineering.com, devicetree@vger.kernel.org,
	linux-clk@vger.kernel.org
Subject: Re: [PATCH v2 02/10] mfd: rz-mtu3: use device-managed reset deassert
Date: Fri, 14 Aug 2026 00:07:37 +0000	[thread overview]
Message-ID: <20260814000737.EDF6B1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260410163530.383818-3-cosmin-gabriel.tanislav.xa@renesas.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

New issues:
- [Low] The commit message description is not capitalized.
- [Low] The newly renamed function `rz_mtu3_mfd_remove` includes the string 'mfd'.

Pre-existing issues:
- [High] Child drivers silently overwrite shared parent state (`ch->dev`), leading to incorrect PM runtime behavior and potential crashes if one sibling driver is unbound.
--

--- Patch [2]: [PATCH v2 02/10] mfd: rz-mtu3: use device-managed reset deassert ---
commit 24acc3a25ff8c1834d9bfb7c89b33b5e39d1f472
Author: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>

mfd: rz-mtu3: use device-managed reset deassert

Replace devm_reset_control_get_exclusive() and the manual
reset_control_deassert()/reset_control_assert() with handling by
devm_reset_control_get_exclusive_deasserted().

> mfd: rz-mtu3: use device-managed reset deassert

[Severity: Low]
This isn't a bug, but should the description after the subsystem prefix be
capitalized? MFD guidelines typically prefer "mfd: <Driver>: <Capitalized
description>".

> diff --git a/drivers/mfd/rz-mtu3.c b/drivers/mfd/rz-mtu3.c
> index 9cdfef610398f..6b9c6831dffa9 100644
> --- a/drivers/mfd/rz-mtu3.c
> +++ b/drivers/mfd/rz-mtu3.c
[ ... ]
> -static void rz_mtu3_reset_assert(void *data)
> +static void rz_mtu3_mfd_remove(void *data)
>  {
>  	mfd_remove_devices(data);
>  }

[Severity: Low]
This isn't a bug, but does this function name violate the MFD naming
conventions? The guidelines suggest avoiding the string "mfd" in driver,
struct, or device names to prevent hard-coding implementation details.

[Severity: High]
This is a pre-existing issue, but does this design allow child drivers to
silently overwrite shared parent state?

The parent MFD driver allocates a shared array of channels. Both pwm-rz-mtu3
and rz-mtu3-cnt drivers share access to channels 1, 2, and 3.

In drivers/pwm/pwm-rz-mtu3.c:rz_mtu3_pwm_probe(), the PWM child driver
unconditionally sets its own device pointer on the shared channel:

    rz_mtu3_pwm->channel_data[j].mtu->dev = dev;

In drivers/counter/rz-mtu3-cnt.c:rz_mtu3_cnt_probe(), the Counter child
driver also unconditionally sets its own device pointer on the same shared
channel:

    ch->dev = dev;

Whichever driver probes last will overwrite the pointer. If the surviving
driver calls pm_runtime_get_sync(ch->dev), it will inadvertently invoke PM
runtime on the other driver's device structure.

If that other driver is unbound via sysfs, its PM runtime is disabled,
causing pm_runtime_get_sync() to fail with -EACCES. The counter driver might
ignore this return value and proceed to access hardware registers without
being properly clocked or powered on.

Could this lead to a synchronous external abort or silent data corruption?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260410163530.383818-1-cosmin-gabriel.tanislav.xa@renesas.com?part=2

  parent reply	other threads:[~2026-08-14  0:07 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 16:35 [PATCH v2 00/10] Add MTU3 for RZ/T2H and RZ/N2H Cosmin Tanislav
2026-04-10 16:35 ` [PATCH v2 01/10] clk: renesas: r9a09g077: add MTU3 module clock Cosmin Tanislav
2026-04-24 13:04   ` Geert Uytterhoeven
2026-04-10 16:35 ` [PATCH v2 02/10] mfd: rz-mtu3: use device-managed reset deassert Cosmin Tanislav
2026-05-07 12:39   ` Lee Jones
2026-05-07 14:19     ` Cosmin-Gabriel Tanislav
2026-05-13 14:12       ` Lee Jones
2026-08-14  0:07   ` sashiko-bot [this message]
2026-04-10 16:35 ` [PATCH v2 03/10] mfd: rz-mtu3: use device-managed mfd_add_devices() Cosmin Tanislav
2026-05-07 12:46   ` Lee Jones
2026-05-07 14:20     ` Cosmin-Gabriel Tanislav
2026-05-20 15:26       ` Lee Jones
2026-04-10 16:35 ` [PATCH v2 04/10] mfd: rz-mtu3: store &pdev->dev in local variable Cosmin Tanislav
2026-05-07 12:47   ` Lee Jones
2026-04-10 16:35 ` [PATCH v2 05/10] mfd: rz-mtu3: make reset optional Cosmin Tanislav
2026-05-07 12:52   ` Lee Jones
2026-04-10 16:35 ` [PATCH v2 06/10] dt-bindings: timer: renesas,rz-mtu3: remove TCIU8 interrupt Cosmin Tanislav
2026-06-13 14:33   ` [tip: timers/clocksource] dt-bindings: timer: renesas,rz-mtu3: Remove " tip-bot2 for Cosmin Tanislav
2026-04-10 16:35 ` [PATCH v2 07/10] dt-bindings: timer: renesas,rz-mtu3: document RZ/{T2H,N2H} Cosmin Tanislav
2026-04-13  6:54   ` Krzysztof Kozlowski
2026-06-13 14:33   ` [tip: timers/clocksource] " tip-bot2 for Cosmin Tanislav
2026-04-10 16:35 ` [PATCH v2 08/10] arm64: dts: renesas: r9a07g0{43,44,54}: remove TCIU8 interrupt from MTU3 Cosmin Tanislav
2026-05-21 13:53   ` Cosmin-Gabriel Tanislav
2026-05-21 13:59     ` Geert Uytterhoeven
2026-05-22 13:43   ` Geert Uytterhoeven
2026-04-10 16:35 ` [PATCH v2 09/10] arm64: dts: renesas: r9a09g077: add MTU3 support Cosmin Tanislav
2026-05-22 13:55   ` Geert Uytterhoeven
2026-04-10 16:35 ` [PATCH v2 10/10] arm64: dts: renesas: r9a09g087: " Cosmin Tanislav
2026-05-22 13:55   ` Geert Uytterhoeven
2026-04-23 11:16 ` [PATCH v2 00/10] Add MTU3 for RZ/T2H and RZ/N2H Daniel Lezcano

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=20260814000737.EDF6B1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=cosmin-gabriel.tanislav.xa@renesas.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.