All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Michael Walle" <mwalle@kernel.org>
Cc: linux-gpio@vger.kernel.org
Subject: Re: [RFT PATCH 02/13] gpio: regmap: add a callback to create the IRQ domain
Date: Thu, 26 Nov 2026 15:47:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-235842@kernel.org> (raw)
In-Reply-To: <20261126153600.299724-3-mwalle@kernel.org>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] gpio: regmap: zero ngpio_per_reg fallback in
  gpio_regmap_register() [1]
--

commit fd10248876b372329d85c754bb2bf0c35ed1c5a7
Author: Michael Walle <mwalle@kernel.org>

gpio: regmap: add a callback to create the IRQ domain

This commit adds a create_irq_domain() callback to struct
gpio_regmap_config so controller drivers can create their IRQ domain
after the gpio_chip has been registered.

> diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
> index 10cf946dbfc47..e8c13434ea5ba 100644
> --- a/drivers/gpio/gpio-regmap.c
> +++ b/drivers/gpio/gpio-regmap.c

[ ... ]

> @@ -545,6 +553,16 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
>  	if (ret < 0)
>  		goto err_free_bitmap_output;
>  
> +	irq_domain = config->irq_domain;
> +
> +	if (config->create_irq_domain) {
> +		irq_domain = config->create_irq_domain(gpio);
> +		if (IS_ERR(irq_domain)) {
> +			ret = PTR_ERR(irq_domain);
> +			goto err_remove_gpiochip;
> +		}
> +	}
> +

[Severity: High]
This problem wasn't introduced by this patch, but can gpio->ngpio_per_reg
remain 0 in gpio_regmap_register() [1]?

Just above this hunk, when config->ngpio is 0 (such as in
ds4520_gpio_probe()), gpiochip_get_ngpios() populates chip->ngpio from the
firmware ngpios property while config->ngpio stays 0:

drivers/gpio/gpio-regmap.c:gpio_regmap_register() {
    ...
	chip->ngpio = config->ngpio;
	if (!chip->ngpio) {
		ret = gpiochip_get_ngpios(chip, chip->parent);
		if (ret)
			goto err_free_gpio;
	}
    ...
	gpio->ngpio_per_reg = config->ngpio_per_reg;
	if (!gpio->ngpio_per_reg)
		gpio->ngpio_per_reg = config->ngpio;
    ...
}

If config->ngpio_per_reg is also unset, the fallback copies config->ngpio
instead of chip->ngpio, leaving gpio->ngpio_per_reg as 0 and causing a
divide-by-zero in gpio_regmap_simple_xlate() when gpiochip_add_data()
queries the initial line directions.

[1] https://sashiko.dev/#/bug/linux-85577bd9-c441-47ec-b415-cd40acf50e01

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126153600.299724-1-mwalle@kernel.org?part=2

  reply	other threads:[~2026-11-26 15:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 15:35 [RFT PATCH 00/13] gpio: regmap: IRQ domain cleanups Michael Walle
2026-11-26 15:35 ` [RFT PATCH 01/13] gpio: regmap: remove gpiochip before tearing down irqchip Michael Walle
2026-11-26 15:35 ` [RFT PATCH 02/13] gpio: regmap: add a callback to create the IRQ domain Michael Walle
2026-11-26 15:47   ` sashiko-bot [this message]
2026-11-26 21:52   ` Joseph Telaak
2026-11-26 15:35 ` [RFT PATCH 03/13] gpio: rtd1625: create the IRQ domain from the gpio-regmap callback Michael Walle
2026-11-26 15:54   ` sashiko-bot
2026-11-26 15:35 ` [RFT PATCH 04/13] gpio: axiado-sgpio: " Michael Walle
2026-11-30  9:39   ` Petar Stepanovic
2026-11-30 10:11     ` Michael Walle
2026-11-26 15:35 ` [RFT PATCH 05/13] gpio: regmap: add a helper to add a regmap-irq chip Michael Walle
2026-11-26 15:35 ` [RFT PATCH 06/13] gpio: max7360: create the regmap-irq chip from the gpio-regmap callback Michael Walle
2026-11-26 20:43   ` Andy Shevchenko
2026-11-27  8:59     ` Michael Walle
2026-11-26 15:35 ` [RFT PATCH 07/13] gpio: sl28cpld: " Michael Walle
2026-11-26 15:35 ` [RFT PATCH 08/13] gpio: idio-16: " Michael Walle
2026-11-26 15:35 ` [RFT PATCH 09/13] gpio: pcie-idio-24: " Michael Walle
2026-11-26 15:48   ` sashiko-bot
2026-11-27  9:03     ` Michael Walle
2026-11-26 15:35 ` [RFT PATCH 10/13] gpio: ws16c48: " Michael Walle
2026-11-26 15:35 ` [RFT PATCH 11/13] gpio: 104-idi-48: " Michael Walle
2026-11-26 15:48   ` sashiko-bot
2026-11-26 15:35 ` [RFT PATCH 12/13] gpio: i8255: " Michael Walle
2026-11-26 15:35 ` [RFT PATCH 13/13] gpio: regmap: remove irq_domain and the regmap-irq configuration Michael Walle
2026-11-26 21:52   ` Joseph Telaak
2026-11-26 20:48 ` [RFT PATCH 00/13] gpio: regmap: IRQ domain cleanups Andy Shevchenko

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-235842@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mwalle@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.