diff options
author | Pat Tjin <pattjin@google.com> | 2021-05-24 14:17:06 -0700 |
---|---|---|
committer | TreeHugger Robot <treehugger-gerrit@google.com> | 2021-05-24 22:18:52 +0000 |
commit | 5c0eb1f2506dd132b5ed1684056c1a8968bfef82 (patch) | |
tree | 2289c28cd3b3dba005580259ef9b5d9a2045effd | |
parent | 5f9f196b6493ce2a6522ccdb6239ccdf217e9b6f (diff) | |
download | sec_touch-5c0eb1f2506dd132b5ed1684056c1a8968bfef82.tar.gz |
touch/sec_ts: Do not get properties of non-existent supplies
Check that usb_psy is valid before getting its properties.
Workqueue: sec_ts-event-queue sec_ts_charger_work [sec_touch]
pstate: 80c00005 (Nzcv daif +PAN +UAO -TCO BTYPE=--)
pc : power_supply_get_property+0x18/0xac
lr : sec_ts_charger_work+0x6c/0x3b8 [sec_touch]
sp : ffffffc0143a3ca0
x29: ffffffc0143a3cc0 x28: 0000000000000402
x27: ffffff8808fba420 x26: 00000000195ee905
x25: 0000000000020032 x24: ffffff88230a3759
x23: ffffffc009a41e60 x22: ffffff88230a1468
x21: 00000000000022f0 x20: 0000000000000000
x19: ffffff88230a0000 x18: ffffffc014385028
x17: 0000000000000003 x16: 000000000000000e
x15: 0000000000000000 x14: 0000000000000018
x13: 0000000000000000 x12: 0000000000007ffb
x11: 000000000000ffff x10: 00000000000022f1
x9 : 0000000000000001 x8 : 00000000000003d8
x7 : 0000000000000000 x6 : 0000000000000000
x5 : fffffffebf8f9150 x4 : ffffff893ae74bc0
x3 : 0000000000000008 x2 : ffffffc0143a3cf0
x1 : 0000000000000003 x0 : 0000000000000000
Call trace:
power_supply_get_property+0x18/0xac
sec_ts_charger_work+0x6c/0x3b8 [sec_touch]
process_one_work+0x218/0x62c
worker_thread+0x290/0x588
kthread+0x158/0x1b0
ret_from_fork+0x10/0x30
Bug: 189139045
Signed-off-by: Pat Tjin <pattjin@google.com>
Change-Id: I62f30acb2aec5ef255cad9cd80d9851b6a1da07c
-rw-r--r-- | sec_ts.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -5290,12 +5290,14 @@ static void sec_ts_charger_work(struct work_struct *work) const u64 debounce_ms = 500; /* usb case */ - ret = power_supply_get_property(ts->usb_psy, - POWER_SUPPLY_PROP_PRESENT, &prop); - if (ret == 0) { - usb_present = !!prop.intval; - if (usb_present) - charger_mode = SEC_TS_BIT_CHARGER_MODE_WIRE_CHARGER; + if (ts->usb_psy != NULL) { + ret = power_supply_get_property(ts->usb_psy, + POWER_SUPPLY_PROP_PRESENT, &prop); + if (ret == 0) { + usb_present = !!prop.intval; + if (usb_present) + charger_mode = SEC_TS_BIT_CHARGER_MODE_WIRE_CHARGER; + } } /* wlc case */ |