From: 黄涛 Date: Thu, 8 Aug 2013 06:37:19 +0000 (+0800) Subject: ts: rk29_i2c_goodix: fix shutdown panic, prevent unregister_early_suspend before... X-Git-Tag: firefly_0821_release~6726^2~31 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=803063762ae766ffed2ffb674b18da5a05402098;p=firefly-linux-kernel-4.4.55.git ts: rk29_i2c_goodix: fix shutdown panic, prevent unregister_early_suspend before register_early_suspend --- diff --git a/drivers/input/touchscreen/rk29_i2c_goodix.c b/drivers/input/touchscreen/rk29_i2c_goodix.c index 4ad739b43d32..d607eccecc8d 100755 --- a/drivers/input/touchscreen/rk29_i2c_goodix.c +++ b/drivers/input/touchscreen/rk29_i2c_goodix.c @@ -780,7 +780,6 @@ static int rk_ts_probe(struct i2c_client *client, const struct i2c_device_id *id ts->power = goodix_ts_power; ts->get_touch_info = goodix_get_touch_info; ts->input_parms_init = goodix_input_params_init; - i2c_set_clientdata(client, ts); if (pdata->init_platform_hw) @@ -821,6 +820,7 @@ static int rk_ts_probe(struct i2c_client *client, const struct i2c_device_id *id ts->early_suspend.resume = rk_ts_late_resume; register_early_suspend(&ts->early_suspend); #endif + i2c_set_clientdata(client, ts); info_buf= kzalloc(ts->max_touch_num*sizeof(struct rk_touch_info), GFP_KERNEL); if(!info_buf) @@ -901,7 +901,8 @@ static void rk_ts_shutdown(struct i2c_client *client) { #ifdef CONFIG_HAS_EARLYSUSPEND struct rk_ts_data *ts = i2c_get_clientdata(client); - unregister_early_suspend(&ts->early_suspend); + if (ts) + unregister_early_suspend(&ts->early_suspend); #endif }