* [PATCH 1/2] pwm: sti: return the error when requesting the IRQ fails
@ 2026-11-27 8:12 Cong Nguyen
2026-11-27 8:12 ` [PATCH 2/2] pwm: sti: request the IRQ after the driver data is initialised Cong Nguyen
0 siblings, 1 reply; 2+ messages in thread
From: Cong Nguyen @ 2026-11-27 8:12 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: linux-pwm, linux-kernel
sti_pwm_probe() calls dev_err_probe() when devm_request_irq() fails but
does not return its result, so probe continues and registers the PWM chip
without the capture interrupt handler. An -EPROBE_DEFER from the request
is also lost.
Return the error, as the code did before it was converted to
dev_err_probe().
Fixes: 3025c9c669ba ("pwm: sti: Improve error reporting using dev_err_probe()")
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
---
If continuing without the capture interrupt was intended, please
ignore this patch.
drivers/pwm/pwm-sti.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pwm/pwm-sti.c b/drivers/pwm/pwm-sti.c
index c1beacb26b4d..bdbb61e44fe8 100644
--- a/drivers/pwm/pwm-sti.c
+++ b/drivers/pwm/pwm-sti.c
@@ -571,7 +571,7 @@ static int sti_pwm_probe(struct platform_device *pdev)
ret = devm_request_irq(&pdev->dev, irq, sti_pwm_interrupt, 0,
pdev->name, pc);
if (ret < 0)
- dev_err_probe(&pdev->dev, ret, "Failed to request IRQ\n");
+ return dev_err_probe(&pdev->dev, ret, "Failed to request IRQ\n");
/*
* Setup PWM data with default values: some values could be replaced
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH 2/2] pwm: sti: request the IRQ after the driver data is initialised
2026-11-27 8:12 [PATCH 1/2] pwm: sti: return the error when requesting the IRQ fails Cong Nguyen
@ 2026-11-27 8:12 ` Cong Nguyen
0 siblings, 0 replies; 2+ messages in thread
From: Cong Nguyen @ 2026-11-27 8:12 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: linux-pwm, linux-kernel
sti_pwm_probe() requests the interrupt right after mapping the registers,
but sti_pwm_interrupt() reads pc->pwm_cpt_int_stat and uses pc->dev and
pc->ddata. Those are set up later in probe, and the clocks that the
register access needs are also enabled later. If the interrupt fires once
it is requested, the handler can run before any of that is ready and
dereference a NULL pwm_cpt_int_stat.
Request the interrupt after the driver data and the clocks are set up, just
before the PWM chip is added.
Fixes: 25eb53809674 ("pwm: sti: Add support for PWM capture interrupts")
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
---
drivers/pwm/pwm-sti.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/pwm/pwm-sti.c b/drivers/pwm/pwm-sti.c
index bdbb61e44fe8..73b8690d596c 100644
--- a/drivers/pwm/pwm-sti.c
+++ b/drivers/pwm/pwm-sti.c
@@ -568,11 +568,6 @@ static int sti_pwm_probe(struct platform_device *pdev)
if (irq < 0)
return irq;
- ret = devm_request_irq(&pdev->dev, irq, sti_pwm_interrupt, 0,
- pdev->name, pc);
- if (ret < 0)
- return dev_err_probe(&pdev->dev, ret, "Failed to request IRQ\n");
-
/*
* Setup PWM data with default values: some values could be replaced
* with specific ones provided from Device Tree.
@@ -614,6 +609,10 @@ static int sti_pwm_probe(struct platform_device *pdev)
}
}
+ ret = devm_request_irq(dev, irq, sti_pwm_interrupt, 0, pdev->name, pc);
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "Failed to request IRQ\n");
+
chip->ops = &sti_pwm_ops;
ret = devm_pwmchip_add(dev, chip);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-27 8:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 8:12 [PATCH 1/2] pwm: sti: return the error when requesting the IRQ fails Cong Nguyen
2026-11-27 8:12 ` [PATCH 2/2] pwm: sti: request the IRQ after the driver data is initialised Cong Nguyen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox