Skip to content

Commit b5e8642

Browse files
smaeulsre
authored andcommitted
power: supply: axp20x_usb_power: Init work before enabling IRQs
The IRQ handler calls mod_delayed_work() on power->vbus_detect. However, that work item is not initialized until after the IRQs are enabled. If an IRQ is already pending when the driver is probed, the driver calls mod_delayed_work() on an uninitialized work item, which causes an oops. Fixes: bcfb7ae ("power: supply: axp20x_usb_power: Only poll while offline") Signed-off-by: Samuel Holland <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent a4bdea2 commit b5e8642

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/power/supply/axp20x_usb_power.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
593593
power->axp20x_id = axp_data->axp20x_id;
594594
power->regmap = axp20x->regmap;
595595
power->num_irqs = axp_data->num_irq_names;
596+
INIT_DELAYED_WORK(&power->vbus_detect, axp20x_usb_power_poll_vbus);
596597

597598
if (power->axp20x_id == AXP202_ID) {
598599
/* Enable vbus valid checking */
@@ -645,7 +646,6 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
645646
}
646647
}
647648

648-
INIT_DELAYED_WORK(&power->vbus_detect, axp20x_usb_power_poll_vbus);
649649
if (axp20x_usb_vbus_needs_polling(power))
650650
queue_delayed_work(system_power_efficient_wq, &power->vbus_detect, 0);
651651

0 commit comments

Comments
 (0)