* [PATCH 1/5] gpio: rcar: don't clobber INTMSK when disabling a single line
2026-11-07 8:12 [PATCH 0/5] gpio: fix IRQ handling and probe error paths in five drivers shao.mingyin
@ 2026-11-07 8:12 ` shao.mingyin
2026-11-07 8:12 ` [PATCH 2/5] gpio: aspeed-sgpio: propagate IRQ setup error in probe shao.mingyin
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: shao.mingyin @ 2026-11-07 8:12 UTC (permalink / raw)
To: linusw, brgl, linux-gpio
Cc: linux-kernel, geert+renesas, andrew, wbg, opendmb,
florian.fainelli, bcm-kernel-feedback-list, jelonek.jonas
From: Shao Mingyin <shao.mingyin@zte.com.cn>
gpio_rcar_irq_disable() writes ~BIT(hwirq) to the whole INTMSK register,
which clears the bit of the line being disabled but sets every other bit
in the bank to 1. Since a set bit in INTMSK means "interrupt enabled"
(gpio_rcar_irq_handler() only handles lines whose INTMSK bit is set),
this disables one GPIO interrupt while collateral-enabling all the
other GPIO interrupts of the bank, which can cause a storm of spurious
cascaded interrupts on level-triggered lines.
Do a read-modify-write to clear only the line being disabled.
Fixes: 119f5e448d32 ("gpio: Renesas R-Car GPIO driver V3")
Cc: stable@vger.kernel.org
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
drivers/gpio/gpio-rcar.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 1192e1f1c6..239d78a2ae 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -129,7 +129,7 @@
struct gpio_rcar_priv *p = gpiochip_get_data(gc);
irq_hw_number_t hwirq = irqd_to_hwirq(d);
- gpio_rcar_write(p, INTMSK, ~BIT(hwirq));
+ gpio_rcar_write(p, INTMSK, gpio_rcar_read(p, INTMSK) & ~BIT(hwirq));
gpiochip_disable_irq(gc, hwirq);
}
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 2/5] gpio: aspeed-sgpio: propagate IRQ setup error in probe
2026-11-07 8:12 [PATCH 0/5] gpio: fix IRQ handling and probe error paths in five drivers shao.mingyin
2026-11-07 8:12 ` [PATCH 1/5] gpio: rcar: don't clobber INTMSK when disabling a single line shao.mingyin
@ 2026-11-07 8:12 ` shao.mingyin
2026-11-07 8:12 ` [PATCH 3/5] gpio: 104-idi-48: fix max_register blocking the IRQ register shao.mingyin
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: shao.mingyin @ 2026-11-07 8:12 UTC (permalink / raw)
To: linusw, brgl, linux-gpio
Cc: linux-kernel, geert+renesas, andrew, wbg, opendmb,
florian.fainelli, bcm-kernel-feedback-list, jelonek.jonas
From: Shao Mingyin <shao.mingyin@zte.com.cn>
aspeed_sgpio_probe() ignores the return value of
aspeed_sgpio_setup_irqs(). That function returns the result of
platform_get_irq(), so on failure - in particular -EPROBE_DEFER while
the parent interrupt controller is still probing - the driver carries on
and registers the gpiochip with no interrupt support, and the deferred
probe is never retried, leaving GPIO interrupts permanently broken.
The "interrupts" property is mandatory for this device, so propagate the
error from probe.
Fixes: 7db47faae79b ("gpio: aspeed: Add SGPIO driver")
Cc: stable@vger.kernel.org
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
drivers/gpio/gpio-aspeed-sgpio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-aspeed-sgpio.c b/drivers/gpio/gpio-aspeed-sgpio.c
index 4225261f61..9df0082270 100644
--- a/drivers/gpio/gpio-aspeed-sgpio.c
+++ b/drivers/gpio/gpio-aspeed-sgpio.c
@@ -686,7 +686,9 @@
gpio->chip.label = dev_name(&pdev->dev);
gpio->chip.base = -1;
- aspeed_sgpio_setup_irqs(gpio, pdev);
+ rc = aspeed_sgpio_setup_irqs(gpio, pdev);
+ if (rc)
+ return rc;
rc = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio);
if (rc < 0)
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 3/5] gpio: 104-idi-48: fix max_register blocking the IRQ register
2026-11-07 8:12 [PATCH 0/5] gpio: fix IRQ handling and probe error paths in five drivers shao.mingyin
2026-11-07 8:12 ` [PATCH 1/5] gpio: rcar: don't clobber INTMSK when disabling a single line shao.mingyin
2026-11-07 8:12 ` [PATCH 2/5] gpio: aspeed-sgpio: propagate IRQ setup error in probe shao.mingyin
@ 2026-11-07 8:12 ` shao.mingyin
2026-11-07 20:19 ` William Breathitt Gray
2026-11-07 8:12 ` [PATCH 4/5] gpio: brcmstb: don't turn platform_get_irq errors into -ENOENT shao.mingyin
2026-11-07 8:12 ` [PATCH 5/5] gpio: line-mux: fix unsigned truncation of property count error shao.mingyin
4 siblings, 1 reply; 7+ messages in thread
From: shao.mingyin @ 2026-11-07 8:12 UTC (permalink / raw)
To: linusw, brgl, linux-gpio
Cc: linux-kernel, geert+renesas, andrew, wbg, opendmb,
florian.fainelli, bcm-kernel-feedback-list, jelonek.jonas
From: Shao Mingyin <shao.mingyin@zte.com.cn>
The regmap config declares max_register = 0x6, but the device's IRQ
status/enable register lives at offset 0x7 (IDI48_IRQ_STATUS /
IDI48_IRQ_ENABLE, also listed in the readable/precious ranges and used
as status_base/unmask_base by the regmap-irq chip). regmap_readable()
and regmap_writeable() both return false for any register above
max_register, so regmap_read() of the status register fails with -EIO
inside regmap_irq_thread() and no GPIO interrupt is ever delivered.
Raise max_register to 0x7 so the IRQ register is accessible.
Fixes: e28432a77365 ("gpio: 104-idi-48: Migrate to the regmap-irq API")
Cc: stable@vger.kernel.org
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
drivers/gpio/gpio-104-idi-48.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c
index fb017569cf..493d1fe708 100644
--- a/drivers/gpio/gpio-104-idi-48.c
+++ b/drivers/gpio/gpio-104-idi-48.c
@@ -78,7 +78,7 @@
.reg_stride = 1,
.val_bits = 8,
.io_port = true,
- .max_register = 0x6,
+ .max_register = 0x7,
.wr_table = &idi_48_wr_table,
.rd_table = &idi_48_rd_table,
.precious_table = &idi_48_precious_table,
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 3/5] gpio: 104-idi-48: fix max_register blocking the IRQ register
2026-11-07 8:12 ` [PATCH 3/5] gpio: 104-idi-48: fix max_register blocking the IRQ register shao.mingyin
@ 2026-11-07 20:19 ` William Breathitt Gray
0 siblings, 0 replies; 7+ messages in thread
From: William Breathitt Gray @ 2026-11-07 20:19 UTC (permalink / raw)
To: shao.mingyin
Cc: William Breathitt Gray, linusw, brgl, linux-gpio, linux-kernel,
geert+renesas, andrew, opendmb, florian.fainelli,
bcm-kernel-feedback-list, jelonek.jonas
On Sat, Nov 07, 2026 at 04:12:55PM +0800, shao.mingyin@zte.com.cn wrote:
> From: Shao Mingyin <shao.mingyin@zte.com.cn>
>
> The regmap config declares max_register = 0x6, but the device's IRQ
> status/enable register lives at offset 0x7 (IDI48_IRQ_STATUS /
> IDI48_IRQ_ENABLE, also listed in the readable/precious ranges and used
> as status_base/unmask_base by the regmap-irq chip). regmap_readable()
> and regmap_writeable() both return false for any register above
> max_register, so regmap_read() of the status register fails with -EIO
> inside regmap_irq_thread() and no GPIO interrupt is ever delivered.
>
> Raise max_register to 0x7 so the IRQ register is accessible.
>
> Fixes: e28432a77365 ("gpio: 104-idi-48: Migrate to the regmap-irq API")
> Cc: stable@vger.kernel.org
> Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
Acked-by: William Breathitt Gray <wbg@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/5] gpio: brcmstb: don't turn platform_get_irq errors into -ENOENT
2026-11-07 8:12 [PATCH 0/5] gpio: fix IRQ handling and probe error paths in five drivers shao.mingyin
` (2 preceding siblings ...)
2026-11-07 8:12 ` [PATCH 3/5] gpio: 104-idi-48: fix max_register blocking the IRQ register shao.mingyin
@ 2026-11-07 8:12 ` shao.mingyin
2026-11-07 8:12 ` [PATCH 5/5] gpio: line-mux: fix unsigned truncation of property count error shao.mingyin
4 siblings, 0 replies; 7+ messages in thread
From: shao.mingyin @ 2026-11-07 8:12 UTC (permalink / raw)
To: linusw, brgl, linux-gpio
Cc: linux-kernel, geert+renesas, andrew, wbg, opendmb,
florian.fainelli, bcm-kernel-feedback-list, jelonek.jonas
From: Shao Mingyin <shao.mingyin@zte.com.cn>
When the "interrupt-controller" property is present, brcmstb_gpio_probe()
maps any platform_get_irq() failure to -ENOENT. This swallows
-EPROBE_DEFER (the parent interrupt controller may not be probed yet),
so the device never gets retried and the GPIO controller is permanently
unavailable. Return the original error code instead.
Fixes: 19a7b6940b78 ("gpio: brcmstb: Add interrupt and wakeup source support")
Cc: stable@vger.kernel.org
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
drivers/gpio/gpio-brcmstb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c
index 3b1aaea639..e23e8f267f 100644
--- a/drivers/gpio/gpio-brcmstb.c
+++ b/drivers/gpio/gpio-brcmstb.c
@@ -655,7 +655,7 @@
if (of_property_read_bool(np, "interrupt-controller")) {
priv->parent_irq = platform_get_irq(pdev, 0);
- if (priv->parent_irq <= 0)
- return -ENOENT;
+ if (priv->parent_irq < 0)
+ return priv->parent_irq;
} else {
priv->parent_irq = -ENOENT;
}
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 5/5] gpio: line-mux: fix unsigned truncation of property count error
2026-11-07 8:12 [PATCH 0/5] gpio: fix IRQ handling and probe error paths in five drivers shao.mingyin
` (3 preceding siblings ...)
2026-11-07 8:12 ` [PATCH 4/5] gpio: brcmstb: don't turn platform_get_irq errors into -ENOENT shao.mingyin
@ 2026-11-07 8:12 ` shao.mingyin
4 siblings, 0 replies; 7+ messages in thread
From: shao.mingyin @ 2026-11-07 8:12 UTC (permalink / raw)
To: linusw, brgl, linux-gpio
Cc: linux-kernel, geert+renesas, andrew, wbg, opendmb,
florian.fainelli, bcm-kernel-feedback-list, jelonek.jonas
From: Shao Mingyin <shao.mingyin@zte.com.cn>
device_property_count_u32() returns an int and reports errors with a
negative errno (e.g. -EINVAL when the "gpio-line-mux-states" property is
missing). Storing that into an unsigned int turns -EINVAL into a huge
value, so the "if (!ngpio)" guard never triggers and struct_size() then
computes a huge size. The allocation fails with -ENOMEM, hiding the
real error; struct_size() saturates on overflow, so this is not an
undersized allocation on 32-bit builds either.
Use a signed int for the count and reject non-positive values.
Fixes: 2b03d9a40cd1 ("gpio: add gpio-line-mux driver")
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
drivers/gpio/gpio-line-mux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-line-mux.c b/drivers/gpio/gpio-line-mux.c
index b4452d956b..19e4212de2 100644
--- a/drivers/gpio/gpio-line-mux.c
+++ b/drivers/gpio/gpio-line-mux.c
@@ -48,12 +48,12 @@
{
struct device *dev = &pdev->dev;
struct gpio_lmux *glm;
- unsigned int ngpio;
+ int ngpio;
size_t size;
int ret;
ngpio = device_property_count_u32(dev, "gpio-line-mux-states");
- if (!ngpio)
+ if (ngpio <= 0)
return -EINVAL;
size = struct_size(glm, gpio_mux_states, ngpio);
^ permalink raw reply [flat|nested] 7+ messages in thread