sx937x: change global_sx937x initialization position

sometimes ps_notify_callback will be called
after reg_notifier immediately

at this time global_sx937x is NULL
will cause kernel panic

change global_sx937x initialization position earlier

Change-Id: I2379ea3113563268d36d5ddc0bb2cb5a510b15e7
Signed-off-by: cuijy1 <cuijy2@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1990372
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Hong Zhang <zhangh12@motorola.com>
Reviewed-by: Tao Sun <suntao2@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
cuijy1 2021-06-24 13:39:13 +08:00 • committed by Jiyue Cui
commit 40459e9cfd

View file

@ -1371,6 +1371,7 @@ static int sx937x_probe(struct i2c_client *client, const struct i2c_device_id *i
}
this = devm_kzalloc(&client->dev,sizeof(sx93XX_t), GFP_KERNEL); /* create memory for main struct */
global_sx937x = this;
LOG_DBG("Initialized Main Memory: 0x%p\n",this);
pButtonInformationData = devm_kzalloc(&client->dev , sizeof(struct totalButtonInformation), GFP_KERNEL);
@ -1611,8 +1612,6 @@ static int sx937x_probe(struct i2c_client *client, const struct i2c_device_id *i
//return -1;
}
global_sx937x = this;
if(pplatData->reinit_on_i2c_failure) {
INIT_DELAYED_WORK(&this->i2c_watchdog_work, sx937x_i2c_watchdog_work);
schedule_delayed_work(&this->i2c_watchdog_work,