Skip to content

Commit 02228f6

Browse files
ribaldabroonie
authored andcommitted
regulator: da9211: Use irq handler when ready
If the system does not come from reset (like when it is kexec()), the regulator might have an IRQ waiting for us. If we enable the IRQ handler before its structures are ready, we crash. This patch fixes: [ 1.141839] Unable to handle kernel read from unreadable memory at virtual address 0000000000000078 [ 1.316096] Call trace: [ 1.316101] blocking_notifier_call_chain+0x20/0xa8 [ 1.322757] cpu cpu0: dummy supplies not allowed for exclusive requests [ 1.327823] regulator_notifier_call_chain+0x1c/0x2c [ 1.327825] da9211_irq_handler+0x68/0xf8 [ 1.327829] irq_thread+0x11c/0x234 [ 1.327833] kthread+0x13c/0x154 Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Adam Ward <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b7b275e commit 02228f6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/regulator/da9211-regulator.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,12 @@ static int da9211_i2c_probe(struct i2c_client *i2c)
498498

499499
chip->chip_irq = i2c->irq;
500500

501+
ret = da9211_regulator_init(chip);
502+
if (ret < 0) {
503+
dev_err(chip->dev, "Failed to initialize regulator: %d\n", ret);
504+
return ret;
505+
}
506+
501507
if (chip->chip_irq != 0) {
502508
ret = devm_request_threaded_irq(chip->dev, chip->chip_irq, NULL,
503509
da9211_irq_handler,
@@ -512,11 +518,6 @@ static int da9211_i2c_probe(struct i2c_client *i2c)
512518
dev_warn(chip->dev, "No IRQ configured\n");
513519
}
514520

515-
ret = da9211_regulator_init(chip);
516-
517-
if (ret < 0)
518-
dev_err(chip->dev, "Failed to initialize regulator: %d\n", ret);
519-
520521
return ret;
521522
}
522523

0 commit comments

Comments
 (0)