sm5602: fix kernel panic when the device resume

fgauge/sm5602
it should return negative value when sm5602 not probe,
otherwise the mobile phone will crash when it is dormant
[ 46.987266] Call trace:
[ 46.987271] __mod_timer.llvm.510399912499890970+0x6dc/0x6e0
[ 46.987274] add_timer+0x20/0x30
[ 46.987279] queue_delayed_work_on+0x9c/0xf4
[ 46.987285] sm_bat_resume+0x24/0x34 [sm5602_fg_mmi]
[ 46.987289] device_resume+0x29c/0x41c
[ 46.987292] dpm_resume+0x1fc/0x500
[ 46.987296] suspend_devices_and_enter+0x180/0x4ac
[ 46.987300] enter_state+0x3e8/0x4c8
[ 46.987303] pm_suspend+0xd0/0x190
[ 46.987307] state_store+0x124/0x15

Change-Id: Ie267de68fd62a930df7846dac273ef70a948bd3b
Signed-off-by: wutao <huaqin89@motorola.com>
Reviewed-on: https://gerrit.mot.com/2146582
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
wutao 2021-12-16 16:57:10 +08:00 • committed by huaqin89
commit 8d9ed582bd

View file

@ -2697,11 +2697,11 @@ static int sm_fg_probe(struct i2c_client *client,
mutex_init(&sm->data_lock);
if (!hal_fg_init(client)) {
pr_err("Failed to Initialize Fuelgauge\n");
goto err_0;
pr_err("Failed to Initialize Fuelgauge\n");
ret = -EIO;
goto err_0;
}
psy_desc = devm_kzalloc(&client->dev, sizeof(*psy_desc), GFP_KERNEL);
if (!psy_desc)
return -ENOMEM;