[PATCH 1/1] extcon: ptn5150: Request IRQ after device init
From: Stewart Hore
Date: Tue Jun 09 2026 - 20:47:55 EST
ptn5150_i2c_probe() requests the threaded INTB IRQ before the extcon
device is registered and before ptn5150_init_dev_type() has run. An
interrupt arriving during probe can therefore run ptn5150_irq_work()
against an extcon device that is not yet registered.
Request the IRQ as the final probe step, once device initialisation is
complete, just prior to the initial state read. Deferring the request
until after devm_add_action_or_reset() also lets devm free the IRQ
before the work is cancelled on unbind.
Fixes: 4ed754de2d66 ("extcon: Add support for ptn5150 extcon driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Stewart Hore <stewart.hore@xxxxxxxxxxxxx>
---
drivers/extcon/extcon-ptn5150.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/extcon/extcon-ptn5150.c b/drivers/extcon/extcon-ptn5150.c
index 4616da7e5430..1af5c6aaa2c5 100644
--- a/drivers/extcon/extcon-ptn5150.c
+++ b/drivers/extcon/extcon-ptn5150.c
@@ -275,16 +275,6 @@ static int ptn5150_i2c_probe(struct i2c_client *i2c)
}
}
- ret = devm_request_threaded_irq(dev, info->irq, NULL,
- ptn5150_irq_handler,
- IRQF_TRIGGER_FALLING |
- IRQF_ONESHOT,
- i2c->name, info);
- if (ret < 0) {
- dev_err(dev, "failed to request handler for INTB IRQ\n");
- return ret;
- }
-
/* Allocate extcon device */
info->edev = devm_extcon_dev_allocate(info->dev, ptn5150_extcon_cable);
if (IS_ERR(info->edev)) {
@@ -320,6 +310,16 @@ static int ptn5150_i2c_probe(struct i2c_client *i2c)
if (ret)
return ret;
+ ret = devm_request_threaded_irq(dev, info->irq, NULL,
+ ptn5150_irq_handler,
+ IRQF_TRIGGER_FALLING |
+ IRQF_ONESHOT,
+ i2c->name, info);
+ if (ret < 0) {
+ dev_err(dev, "failed to request handler for INTB IRQ\n");
+ return ret;
+ }
+
/*
* Update current extcon state if for example OTG connection was there
* before the probe
--
2.54.0