power: qpnp-smbcharger: fix a potential race condition in accessing dc_psy
Commit abc711031653f5af30de63fdf41e878d9b4a09c1 ("power:
qpnp-smbcharger: Fix uninitialized access to dc_psy") tried
fixing an uninitialized access to dc_psy. However, there is
a race condition where dc_psy_type can get set just after
reading from device tree node but the dc_psy itself was not
registered at all.
This ends up in a system crash when the driver tries to call
power_supply_changed of dc_psy when it's not even registered.
Fix this by checking whether the dc_psy is registered before
calling power_supply_changed.
CRs-Fixed: 852821
Change-Id: Ic5f032107e0f5f1190b335e9d5de3e5497fd1e3c
Signed-off-by:
Subbaraman Narayanamurthy <subbaram@codeaurora.org>
Signed-off-by:
Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Loading
Please register or sign in to comment