From 40459e9cfdf945a37a78601fe3aad7b3ad4b4adc Mon Sep 17 00:00:00 2001 From: cuijy1 Date: Thu, 24 Jun 2021 13:39:13 +0800 Subject: [PATCH] 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 Reviewed-on: https://gerrit.mot.com/1990372 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Hong Zhang Reviewed-by: Tao Sun Submit-Approved: Jira Key --- drivers/misc/sx937x/sx937x_sar.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/misc/sx937x/sx937x_sar.c b/drivers/misc/sx937x/sx937x_sar.c index 804f24da791e..2e47d1586879 100644 --- a/drivers/misc/sx937x/sx937x_sar.c +++ b/drivers/misc/sx937x/sx937x_sar.c @@ -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,