[PATCH 5/8] regulator: tps6594-regulator: Bind IRQ resources to child platform device

From: Lee Jones

Date: Fri Nov 27 2026 - 13:37:10 EST


tps6594_regulator_probe() and tps6594_request_reg_irqs() allocate IRQ
data and request threaded IRQs using devres attached to the parent MFD
device tps->dev, while registering the regulators with &pdev->dev. If
probe fails partway through or the regulator platform device is unbound,
the regulators are unregistered and freed while the threaded IRQs remain
active with dangling rdev pointers and block subsequent probes.

Attach the devm_kmalloc_objs() allocations and devm_request_threaded_irq()
handlers to &pdev->dev so LIFO devres teardown frees the IRQs before
unregistering the regulators and freeing the IRQ data.

Fixes: f17ccc5deb4d ("regulator: tps6594-regulator: Add driver for TI TPS6594 regulators")
Closes: https://sashiko.dev/#/bug/linux-5557312d-1058-44ee-a8e4-cb48dab3566f
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/regulator/tps6594-regulator.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/tps6594-regulator.c b/drivers/regulator/tps6594-regulator.c
index 66052753610f..dab4bd6b0282 100644
--- a/drivers/regulator/tps6594-regulator.c
+++ b/drivers/regulator/tps6594-regulator.c
@@ -549,7 +549,7 @@ static int tps6594_request_reg_irqs(struct platform_device *pdev,
irq_data[*irq_idx].type = irq_type;
irq_data[*irq_idx].rdev = rdev;

- error = devm_request_threaded_irq(tps->dev, irq, NULL,
+ error = devm_request_threaded_irq(&pdev->dev, irq, NULL,
tps6594_regulator_irq_handler, IRQF_ONESHOT,
irq_type->irq_name, &irq_data[*irq_idx]);
if (error) {
@@ -738,7 +738,7 @@ static int tps6594_regulator_probe(struct platform_device *pdev)

reg_irq_nb = desc->num_irq_types * (desc->num_buck_regs + desc->num_ldo_regs);

- irq_data = devm_kmalloc_objs(tps->dev,
+ irq_data = devm_kmalloc_objs(&pdev->dev,
struct tps6594_regulator_irq_data,
reg_irq_nb);
if (!irq_data)
@@ -828,7 +828,7 @@ static int tps6594_regulator_probe(struct platform_device *pdev)
return error;
}

- irq_ext_reg_data = devm_kmalloc_objs(tps->dev,
+ irq_ext_reg_data = devm_kmalloc_objs(&pdev->dev,
struct tps6594_ext_regulator_irq_data,
desc->num_ext_irqs);
if (!irq_ext_reg_data)
@@ -843,7 +843,7 @@ static int tps6594_regulator_probe(struct platform_device *pdev)
irq_ext_reg_data[i].dev = tps->dev;
irq_ext_reg_data[i].type = irq_type;

- error = devm_request_threaded_irq(tps->dev, irq, NULL,
+ error = devm_request_threaded_irq(&pdev->dev, irq, NULL,
tps6594_ext_regulator_irq_handler,
IRQF_ONESHOT,
irq_type->irq_name,
--
2.56.1.839.g22a8290db9-goog