]> git.ipfire.org Git - thirdparty/linux.git/commit
regulator: tps65219: fix irq_data.rdev not being assigned
authorAlexander Sverdlin <alexander.sverdlin@siemens.com>
Mon, 18 May 2026 08:31:11 +0000 (10:31 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 18 May 2026 09:52:24 +0000 (10:52 +0100)
commitf9b2d3b703d13df50c630997dfdc25648e96db0d
treee7ecbbc8c4c1385bf41fc42fbead871744572359
parentcbdbfba9e8907bea923874d05d6a35ff429a5544
regulator: tps65219: fix irq_data.rdev not being assigned

Commit 64a6b577490c ("regulator: tps65219: Remove debugging helper
function") removed the tps65219_get_rdev_by_name() helper along with
the irq_data.rdev assignment that depended on it. This left
irq_data.rdev uninitialized for all IRQs, causing undefined behavior
when regulator_notifier_call_chain() is called from the IRQ handler:

  Internal error: Oops: 0000000096000004
  pc : regulator_notifier_call_chain
  lr : tps65219_regulator_irq_handler
  Call trace:
   regulator_notifier_call_chain
   tps65219_regulator_irq_handler
   handle_nested_irq
   regmap_irq_thread
   irq_thread_fn
   irq_thread
   kthread
   ret_from_fork

Instead of restoring a dedicated lookup array, restructure the probe
function to combine regulator registration with IRQ registration in
the same loop. This way the rdev returned by devm_regulator_register()
is naturally available for assigning to irq_data.rdev without any
auxiliary data structure.

Non-regulator IRQs (SENSOR, TIMEOUT) that don't correspond to any
registered regulator are registered with rdev=NULL, and the IRQ handler
is protected with a NULL check to avoid crashing.

Cc: stable@vger.kernel.org
Closes: https://lore.kernel.org/all/aBDSTxALaOc-PD7X@gaggiata.pivistrello.it/
Reported-by: Francesco Dolcini <francesco@dolcini.it>
Fixes: 64a6b577490c ("regulator: tps65219: Remove debugging helper function")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Link: https://patch.msgid.link/20260518083113.2063368-1-alexander.sverdlin@siemens.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/tps65219-regulator.c