Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Cosmin Tanislav" <cosmin-gabriel.tanislav.xa@renesas.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org,
	linux-clk@vger.kernel.org, wsa+renesas@sang-engineering.com,
	conor+dt@kernel.org
Subject: Re: [PATCH 04/11] mfd: rz-mtu3: store &pdev->dev in local variable
Date: Thu, 13 Aug 2026 23:00:18 +0000	[thread overview]
Message-ID: <20260813230018.812221F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260327192425.438263-5-cosmin-gabriel.tanislav.xa@renesas.com>

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

Pre-existing issues:
- [High] The parent driver exports numerous bespoke accessors (e.g., rz_mtu3_shared_reg_read, rz_mtu3_enable) for child drivers, violating MFD subsystem guidelines.
- [High] The driver passes 0 instead of PLATFORM_DEVID_AUTO as the ID in devm_mfd_add_devices, risking sysfs naming collisions.
--

--- Patch [4]: [PATCH 04/11] mfd: rz-mtu3: store &pdev->dev in local variable ---
commit 99cfbc12a5f5e788a17b9baa33f5115c64650afc
Author: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>

mfd: rz-mtu3: store &pdev->dev in local variable

This commit introduces a local dev variable in rz_mtu3_probe() to store
&pdev->dev. It replaces multiple occurrences of &pdev->dev with this new
variable to simplify the code.

> diff --git a/drivers/mfd/rz-mtu3.c b/drivers/mfd/rz-mtu3.c
> index 3be6f6c900b82..37d12030e069c 100644
> --- a/drivers/mfd/rz-mtu3.c
> +++ b/drivers/mfd/rz-mtu3.c
[ ... ]
> @@ -347,7 +348,7 @@ static int rz_mtu3_probe(struct platform_device *pdev)
>  		mutex_init(&ddata->channels[i].lock);
>  	}
>  
> -	return devm_mfd_add_devices(&pdev->dev, 0, rz_mtu3_devs,
> +	return devm_mfd_add_devices(dev, 0, rz_mtu3_devs,
>  				    ARRAY_SIZE(rz_mtu3_devs), NULL, 0, NULL);
>  }

[Severity: High]
This isn't a bug introduced by this patch, but is a pre-existing API violation.
Does passing 0 instead of PLATFORM_DEVID_AUTO as the ID in
devm_mfd_add_devices() risk sysfs naming collisions?

According to MFD subsystem guidelines, using hard-coded IDs maps all cell
IDs to instance numbers, which can lead to device naming collisions in sysfs
and driver load failures.

While reviewing the file, I also noticed another pre-existing issue in the
parent driver:

[Severity: High]
This is a pre-existing issue, but the parent driver exports bespoke accessors
for child drivers. For example:

drivers/mfd/rz-mtu3.c:rz_mtu3_shared_reg_read() {
	struct rz_mtu3 *mtu = dev_get_drvdata(ch->dev->parent);
	struct rz_mtu3_priv *priv = mtu->priv_data;
...
}

Does exporting custom accessors like rz_mtu3_shared_reg_read() create tight
coupling between parent and child drivers?

The MFD guidelines indicate that custom parent-child accessors make refactoring
fragile and can lead to silent use-after-free bugs if lifetime mismatches
occur. Child drivers should prefer using standard APIs directly instead.

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

  reply	other threads:[~2026-08-13 23:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27 19:24 [PATCH 00/11] Add MTU3 for RZ/T2H and RZ/N2H Cosmin Tanislav
2026-03-27 19:24 ` [PATCH 01/11] clk: renesas: r9a09g077: add MTU3 module clock Cosmin Tanislav
2026-03-27 19:24 ` [PATCH 02/11] mfd: rz-mtu3: use device-managed reset deassert Cosmin Tanislav
2026-08-13 23:03   ` sashiko-bot
2026-03-27 19:24 ` [PATCH 03/11] mfd: rz-mtu3: use device-managed mfd_add_devices() Cosmin Tanislav
2026-03-27 19:24 ` [PATCH 04/11] mfd: rz-mtu3: store &pdev->dev in local variable Cosmin Tanislav
2026-08-13 23:00   ` sashiko-bot [this message]
2026-03-27 19:24 ` [PATCH 05/11] mfd: rz-mtu3: make reset optional Cosmin Tanislav
2026-03-27 19:24 ` [PATCH 06/11] dt-bindings: timer: renesas,rz-mtu3: remove TCIU8 interrupt Cosmin Tanislav
2026-04-07 19:21   ` Rob Herring (Arm)
2026-04-08  7:57   ` Geert Uytterhoeven
2026-03-27 19:24 ` [PATCH 07/11] dt-bindings: timer: renesas,rz-mtu3: move required resets to conditional Cosmin Tanislav
2026-04-07 19:22   ` Rob Herring (Arm)
2026-03-27 19:24 ` [PATCH 08/11] dt-bindings: timer: renesas,rz-mtu3: document RZ/{T2H,N2H} Cosmin Tanislav
2026-04-07 19:24   ` Rob Herring
2026-03-27 19:24 ` [PATCH 09/11] arm64: dts: renesas: r9a07g0{43,44,54}: remove TCIU8 interrupt from MTU3 Cosmin Tanislav
2026-03-27 19:24 ` [PATCH 10/11] arm64: dts: renesas: r9a09g077: add MTU3 support Cosmin Tanislav
2026-03-27 19:24 ` [PATCH 11/11] arm64: dts: renesas: r9a09g087: " Cosmin Tanislav

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=20260813230018.812221F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox