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>
3 files changed