power: supply: axp20x_usb_power: Init work before enabling IRQs
authorSamuel Holland <samuel@sholland.org>
Sun, 24 Jan 2021 15:24:21 +0000 (09:24 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:37:59 +0000 (11:37 +0100)
commit564c05da080fe9d074998aace5cb1749a28c1274
treef3fd4a8a8f888e4a9dfd73e36a85f844edd7875b
parentb1ff96e9191d7fdbf4c6eb00780d47c884acdaec
power: supply: axp20x_usb_power: Init work before enabling IRQs

[ Upstream commit b5e8642ed95ff6ecc20cc6038fe831affa9d098c ]

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: bcfb7ae3f50b ("power: supply: axp20x_usb_power: Only poll while offline")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/power/supply/axp20x_usb_power.c