All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jisheng Zhang" <jszhang@kernel.org>
Cc: devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-gpio@vger.kernel.org, mfd@lists.linux.dev, robh@kernel.org,
	conor+dt@kernel.org, lee@kernel.org
Subject: Re: [PATCH v4 06/13] mfd: synaptics: add SL2610 system controller support
Date: Fri, 04 Dec 2026 15:58:45 +0000	[thread overview]
Message-ID: <sashiko-outbox-250145@kernel.org> (raw)
In-Reply-To: <20261204140732.31223-7-jszhang@kernel.org>

Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [Medium] mfd: sl2610-syscon: unchecked NULL from
  device_get_match_data() in probe
- [Low] mfd: sl2610-syscon: single-function AVIO and CPU blocks wrapped
  in MFD
- [Low] mfd: sl2610-syscon: pass enum ID instead of mfd_cell arrays in
  match data
- [Low] mfd: sl2610-syscon: commit subject violates MFD prefix and
  capitalization
- [Low] mfd: sl2610-syscon: mfd_cell arrays in match data and unchecked
  dereference
--

commit 7c12564f7c07b048184bd552b6f9d7507c32b275
Author: Jisheng Zhang <jszhang@kernel.org>

mfd: synaptics: add SL2610 system controller support

This patch adds an MFD driver for Synaptics SL2610 system controller
blocks to register platform devices for their clock, reset and pin
controller sub-functions.

> mfd: synaptics: add SL2610 system controller support

[Severity: Low]
MFD commit subjects follow the "mfd: <driver>: <Capitalized description>"
format.  For this driver, that would be "mfd: sl2610-syscon: Add Synaptics
SL2610 system controller support".

> diff --git a/drivers/mfd/sl2610-syscon.c b/drivers/mfd/sl2610-syscon.c
> new file mode 100644
> index 0000000000000..c6fc2955ac0de
> --- /dev/null
> +++ b/drivers/mfd/sl2610-syscon.c
> @@ -0,0 +1,84 @@

[ ... ]

> +struct sl2610_syscon_data {
> +	const struct mfd_cell *cells;
> +	unsigned int num_cells;
> +};

[Severity: Low]
Is this wrapper struct needed?  New MFD drivers avoid passing mfd_cell
arrays via match-table .data; storing a non-zero enum ID in .data and
switching in sl2610_syscon_probe() avoids both these wrappers and the
unchecked match-data dereference on non-OF binds.

[ ... ]

> +static const struct mfd_cell sl2610_avio_cells[] = {
> +	MFD_CELL_NAME("sl2610-avio-clk"),
> +};
> +
> +static const struct mfd_cell sl2610_cpu_cells[] = {
> +	MFD_CELL_NAME("sl2610-cpu-clk"),
> +};

[Severity: Low]
Should the AVIO and CPU blocks be handled by this MFD driver at all?

Both blocks only instantiate a single clock child, and their DT bindings
describe single-function clock controllers rather than multi-function
devices.  The clock driver can match syna,sl2610-avio-syscon and
syna,sl2610-cpu-syscon directly while keeping generic syscon access.

The commit message also states that each block implements clock, reset and
pin controller devices, which does not hold for AVIO and CPU.

[ ... ]

> +static int sl2610_syscon_probe(struct platform_device *pdev)
> +{
> +	const struct sl2610_syscon_data *data = device_get_match_data(&pdev->dev);
> +
> +	return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO,
> +				    data->cells, data->num_cells, NULL, 0, NULL);
> +}

[Severity: Medium]
Can device_get_match_data() return NULL here and cause a NULL pointer
dereference on data->cells?

sl2610_syscon_driver does not set suppress_bind_attrs, so binding a
non-OF platform device via sysfs driver_override and bind invokes
sl2610_syscon_probe() without an OF match.  Checking if (!data) and
returning -ENODEV prevents the oops.

> +
> +static const struct of_device_id sl2610_syscon_of_match[] = {
> +	{ .compatible = "syna,sl2610-soc-syscon", .data = &sl2610_soc_data },
> +	{ .compatible = "syna,sl2610-mcu-syscon", .data = &sl2610_mcu_data },
> +	{ .compatible = "syna,sl2610-avio-syscon", .data = &sl2610_avio_data },
> +	{ .compatible = "syna,sl2610-cpu-syscon", .data = &sl2610_cpu_data },
> +	{ }
> +};

[Severity: Low]
Should sl2610_syscon_of_match store enum or integer IDs in .data instead
of pointers to mfd_cell wrapper structs?  MFD convention for new drivers
is to put an ID in .data and pick the static const mfd_cell array with a
switch in probe.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204140732.31223-1-jszhang@kernel.org?part=6

  reply	other threads:[~2026-12-04 15:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 14:07 [PATCH v4 00/13] arm64: add Synaptics SL2610 SoCs and RDK boards Jisheng Zhang
2026-12-04 14:07 ` [PATCH v4 01/13] arm64: kconfig: let ARCH_BERLIN cover Synaptics arm64 SoCs Jisheng Zhang
2026-12-04 14:07 ` [PATCH v4 02/13] pinctrl: berlin: use u16 instead of u8 for the offset Jisheng Zhang
2026-12-04 14:07 ` [PATCH v4 03/13] pinctrl: berlin: enable module build support Jisheng Zhang
2026-12-04 15:03   ` sashiko-bot
2026-12-04 14:07 ` [PATCH v4 04/13] pinctrl: berlin: add optional pinconf support Jisheng Zhang
2026-12-04 15:22   ` sashiko-bot
2026-12-04 14:07 ` [PATCH v4 05/13] dt-bindings: soc: synaptics: add SL2610 system controllers Jisheng Zhang
2026-12-04 15:41   ` sashiko-bot
2026-12-04 14:07 ` [PATCH v4 06/13] mfd: synaptics: add SL2610 system controller support Jisheng Zhang
2026-12-04 15:58   ` sashiko-bot [this message]
2026-12-04 14:07 ` [PATCH v4 07/13] reset: add Synaptics SL2610 reset " Jisheng Zhang
2026-12-04 16:24   ` sashiko-bot
2026-12-04 14:07 ` [PATCH v4 08/13] pinctrl: berlin: add Synaptics SL2610 pin " Jisheng Zhang
2026-12-04 16:51   ` sashiko-bot
2026-12-04 14:07 ` [PATCH v4 09/13] clk: berlin: add Synaptics clock controller helpers Jisheng Zhang
2026-12-04 17:13   ` sashiko-bot
2026-12-04 14:07 ` [PATCH v4 10/13] clk: berlin: add Synaptics SL2610 clocks and PLLs Jisheng Zhang
2026-12-04 17:39   ` sashiko-bot
2026-12-04 14:07 ` [PATCH v4 11/13] dt-bindings: arm: berlin: add Synaptics SL2610 SoCs and RDK boards Jisheng Zhang
2026-12-04 14:07 ` [PATCH v4 12/13] arm64: dts: synaptics: add SL2610 family SoCs Jisheng Zhang
2026-12-04 18:05   ` sashiko-bot
2026-12-04 14:07 ` [PATCH v4 13/13] arm64: dts: synaptics: add SL2610 family RDK boards Jisheng Zhang
2026-12-04 18:19   ` sashiko-bot

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=sashiko-outbox-250145@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jszhang@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.