Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alim Akhtar" <alim.akhtar@samsung.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH 3/5] pinctrl: samsung: Add Exynos8855 pinctrl configuration
Date: Fri, 12 Jun 2026 16:27:57 +0000	[thread overview]
Message-ID: <20260612162757.DD4131F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260612163020.411761-4-alim.akhtar@samsung.com>

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

New issues:
- [Medium] Assigning `.eint_gpio_init = exynos_eint_gpio_init` for the ALIVE and CMGP pin controllers is incorrect and will trigger an unconditional `dev_err` on boot.

Pre-existing issues:
- [High] Out-of-bounds shift and integer truncation in `exynos_wkup_irq_set_wake` due to sparse `eint_offset` values in Exynos8855 pin banks.
--

commit 44d88e7478f7688359e44e48fa60a820ac3e8dfa
Author: Alim Akhtar <alim.akhtar@samsung.com>

pinctrl: samsung: Add Exynos8855 pinctrl configuration

Add pinctrl configuration for Exynos8855. The bank type macros are
reused from Exynos850 SoC.

> diff --git a/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c b/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c
> index fe9f92cb037ea..ba2a11f8e19d8 100644
> --- a/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c
> +++ b/drivers/pinctrl/samsung/pinctrl-exynos-arm64.c

[ ... ]

> +/* pin banks of exynos8855 pin-controller 1 (CMGP) */
> +static const struct samsung_pin_bank_data exynos8855_pin_banks1[] __initconst = {
> +	EXYNOS850_PIN_BANK_EINTW(1, 0x00,  "gpm0",  0x00),

[ ... ]

> +	EXYNOS850_PIN_BANK_EINTW(1, 0x280, "gpm20", 0x50),
> +	EXYNOS850_PIN_BANK_EINTW(1, 0x2a0, "gpm21", 0x54),
> +};

[Severity: High]
This is a pre-existing issue, but does the configuration of these eint_offset
values (up to 0x54) expose an out-of-bounds shift issue?

Looking at exynos_wkup_irq_set_wake() in
drivers/pinctrl/samsung/pinctrl-exynos.c, it sets wake mask bits using:

    unsigned long bit = 1UL << (2 * bank->eint_offset + irqd->hwirq);

If eint_offset is 0x54, the shift amount becomes 168, which invokes C
undefined behavior. Even for shifts between 32 and 63, the 64-bit value is
bitwise OR'd into a u32, dropping the upper bits and breaking the hardware
wakeup masks for these pins.

Will this logic need updating to support these sparse CMGP banks?

[ ... ]

> +static const struct samsung_pin_ctrl exynos8855_pin_ctrl[] __initconst = {
> +	{
> +		/* pin-controller instance 0 ALIVE data */
> +		.pin_banks	= exynos8855_pin_banks0,
> +		.nr_banks	= ARRAY_SIZE(exynos8855_pin_banks0),
> +		.eint_wkup_init = exynos_eint_wkup_init,
> +		.eint_gpio_init = exynos_eint_gpio_init,
> +	}, {
> +		/* pin-controller instance 1 CMGP data */
> +		.pin_banks	= exynos8855_pin_banks1,
> +		.nr_banks	= ARRAY_SIZE(exynos8855_pin_banks1),
> +		.eint_wkup_init = exynos_eint_wkup_init,
> +		.eint_gpio_init = exynos_eint_gpio_init,
> +	}, {

[Severity: Medium]
Is it correct to assign exynos_eint_gpio_init to the eint_gpio_init
callback for the ALIVE and CMGP controllers?

Because these controllers only contain EINT_TYPE_WKUP and EINT_TYPE_NONE
banks, they do not support standard GPIO interrupts and typically lack an
interrupts property in the device tree.

When exynos_eint_gpio_init runs and sees no irq, won't it unconditionally
log an error during boot:

    dev_err(dev, "irq number not available\n");
    
and return -EINVAL? Does this initialization need to be omitted here,
similar to how it is handled in exynos850_pin_ctrl?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260612163020.411761-1-alim.akhtar@samsung.com?part=3

  reply	other threads:[~2026-06-12 16:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20260612161128epcas5p2fe6ebf4b1a7b3ad1794804768180cbdd@epcas5p2.samsung.com>
2026-06-12 16:30 ` [PATCH 0/5] Add minimal Exynos8855 SoC support Alim Akhtar
2026-06-12 16:30   ` [PATCH 1/5] dt-binding: ARM: samsung: Add Samsung Exynos8855 Alim Akhtar
2026-06-12 16:30   ` [PATCH 2/5] dt-binding: pinctrl: samsung: Add exynos8855-pinctrl compatible Alim Akhtar
2026-06-12 16:21     ` sashiko-bot
2026-06-12 16:30   ` [PATCH 3/5] pinctrl: samsung: Add Exynos8855 pinctrl configuration Alim Akhtar
2026-06-12 16:27     ` sashiko-bot [this message]
2026-06-12 16:30   ` [PATCH 4/5] arm64: dts: exynos: add initial support for Samsung Exynos8855 smdk Alim Akhtar
2026-06-12 16:23     ` sashiko-bot
2026-06-12 16:30   ` [PATCH 5/5] MAINTAINERS: Add entry for Samsung Exynos8855 SoC Alim Akhtar

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=20260612162757.DD4131F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alim.akhtar@samsung.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox