usb: pd: Register power_supply notifier after completing init
There is a rare but possible chance that just after registering
the psy_changed notifier callback with the power_supply
framework that it could be called immediately, schedule the
usbpd_sm, and execute the worker on another thread, all before
usbpd_create() has completed. Since some structures, notably
pd->rx_lock, haven't been fully initialized yet, this leads
to spin_lock() call accessing uninitialized data. Fix this by
moving the power_supply_reg_notifier() call to the very end
of usbpd_create() after everything has been initialized.
Change-Id: I7d2bc9eca8e7e30dbc656be620a0f4fd8eea2239
Signed-off-by:
Jack Pham <jackp@codeaurora.org>
Loading
Please register or sign in to comment