OSDN Git Service

qcom: battery: Fix using stale votable pointers
authorHarry Yang <harryy@codeaurora.org>
Thu, 6 Apr 2017 07:02:30 +0000 (00:02 -0700)
committerAbhijeet Dharmapurikar <adharmap@codeaurora.org>
Tue, 2 May 2017 02:36:44 +0000 (19:36 -0700)
commit3ecadbc42fc0ba66e75a218e353a863ad881b97c
tree86f101e5a30d62e06510064435660ab4e0426add
parent0f0e36134d8a1082f099d543a122cd10d777beda
qcom: battery: Fix using stale votable pointers

The code flow between battery.c and smblib.c could end up with
stale references in smblib. This is when if pl_init fails for
some reason after creating the votables, while smblib obtains
references to them, those references become invalid.

Fix this by calling pl_init early in smb2 driver's probe such that if
it fails smb2 driver exits early.

Also change the name of pl_(de)init() functions to more appropriate
name - qcom_batt_(de)init().

Change-Id: I58f79d26e6cc8524e792a23185ff6fc8cfdffa75
Signed-off-by: Harry Yang <harryy@codeaurora.org>
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
drivers/power/supply/qcom/battery.c
drivers/power/supply/qcom/battery.h [new file with mode: 0644]
drivers/power/supply/qcom/smb-lib.c