Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Perrot (Schneider Electric)" <thomas.perrot@bootlin.com>
Cc: devicetree@vger.kernel.org, linux-gpio@vger.kernel.org,
	imx@lists.linux.dev, linux-watchdog@vger.kernel.org,
	mfd@lists.linux.dev, robh@kernel.org, conor+dt@kernel.org,
	Frank.Li@kernel.org, lee@kernel.org
Subject: Re: [PATCH v10 3/5] mfd: aaeon: Add SRG-IMX8P MCU driver
Date: Fri, 20 Nov 2026 07:36:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-224633@kernel.org> (raw)
In-Reply-To: <20261120-dev-b4-aaeon-mcu-driver-v10-3-a756687e7997@bootlin.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mfd: aaeon: unbounded GPIO argument in aaeon_mcu_volatile_reg()
--

commit 3bd6a7daf3a3071df36fa41d3683d38fca074776
Author: Thomas Perrot (Schneider Electric) <thomas.perrot@bootlin.com>

mfd: aaeon: Add SRG-IMX8P MCU driver

This commit adds an MFD driver for the Aaeon SRG-IMX8P embedded controller,
providing a custom I2C regmap bus and registering GPIO and watchdog child
devices.

> diff --git a/drivers/mfd/aaeon-mcu.c b/drivers/mfd/aaeon-mcu.c
> new file mode 100644
> index 0000000000000..83a63e0b73739
> --- /dev/null
> +++ b/drivers/mfd/aaeon-mcu.c

[ ... ]

> +static bool aaeon_mcu_volatile_reg(struct device *dev, unsigned int reg)
> +{
> +	/*
> +	 * GPIO input registers are driven by external signals and can change
> +	 * at any time without CPU involvement, always read from hardware.
> +	 *
> +	 * The watchdog status register reflects hardware state and can change
> +	 * autonomously.
> +	 *
> +	 * All other registers are written by the driver and their values are
> +	 * stable, so they can be safely cached.
> +	 */
> +	if (AAEON_MCU_REG_OPCODE(reg) == AAEON_MCU_READ_GPIO_OPCODE)
> +		return true;
> +	if (reg == AAEON_MCU_WDT_STATUS_REG)
> +		return true;
> +	return false;
> +}
> +
> +static bool aaeon_mcu_readable_reg(struct device *dev, unsigned int reg)
> +{
> +	/*
> +	 * Every opcode but the GPIO input read and the watchdog status is a
> +	 * command: the frame sent for a read is identical to the one used to
> +	 * write it, so reading such a register would execute the command.
> +	 * Only the registers reflecting hardware state may be read.
> +	 */
> +	return aaeon_mcu_volatile_reg(dev, reg);
> +}

[Severity: Low]
Should aaeon_mcu_volatile_reg() bound the low-byte GPIO argument for
AAEON_MCU_READ_GPIO_OPCODE to the valid GPIO index range (0x00..0x0b)?

AAEON_MCU_MAX_REGISTER is AAEON_MCU_REG(0x77, 0x0B), so regmap debugfs
scans the entire 0x7200..0x72ff range.  Because aaeon_mcu_readable_reg()
delegates to aaeon_mcu_volatile_reg() and only the opcode byte is checked,
reading the debugfs registers file issues I2C READ_GPIO transfers for
non-existent GPIO arguments 0x0c..0xff.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120-dev-b4-aaeon-mcu-driver-v10-0-a756687e7997@bootlin.com?part=3

  reply	other threads:[~2026-11-20  7:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  7:23 [PATCH v10 0/5] Add support for AAEON SRG-IMX8P MCU Thomas Perrot (Schneider Electric)
2026-11-20  7:23 ` [PATCH v10 1/5] dt-bindings: vendor-prefixes: Add AAEON vendor prefix Thomas Perrot (Schneider Electric)
2026-11-20  7:23 ` [PATCH v10 2/5] dt-bindings: mfd: Add AAEON embedded controller Thomas Perrot (Schneider Electric)
2026-11-20  7:23 ` [PATCH v10 3/5] mfd: aaeon: Add SRG-IMX8P MCU driver Thomas Perrot (Schneider Electric)
2026-11-20  7:36   ` sashiko-bot [this message]
2026-11-20  7:23 ` [PATCH v10 4/5] gpio: aaeon: Add GPIO driver for SRG-IMX8P MCU Thomas Perrot (Schneider Electric)
2026-11-20  7:23 ` [PATCH v10 5/5] watchdog: aaeon: Add watchdog " Thomas Perrot (Schneider Electric)

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-224633@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=lee@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=thomas.perrot@bootlin.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