max1720x_battery: add mutex_lock to prevent possible circular locking
max1720x_set_property -> model_work is possible cause the same possible
circular locking as b/180734081. We add the same protect here
Signed-off-by: Jenny Ho <[email protected]>
Change-Id: Id2d7ab73c8a04903563740b3f694995c30ac5986
diff --git a/max1720x_battery.c b/max1720x_battery.c
index 3c1fe51..77622c7 100644
--- a/max1720x_battery.c
+++ b/max1720x_battery.c
@@ -1978,12 +1978,15 @@
int delay_ms = 0;
int rc = 0;
+ mutex_lock(&chip->model_lock);
pm_runtime_get_sync(chip->dev);
if (!chip->init_complete || !chip->resume_complete) {
pm_runtime_put_sync(chip->dev);
+ mutex_unlock(&chip->model_lock);
return -EAGAIN;
}
pm_runtime_put_sync(chip->dev);
+ mutex_unlock(&chip->model_lock);
switch (psp) {
case GBMS_PROP_BATT_CE_CTRL: