From 803063762ae766ffed2ffb674b18da5a05402098 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Thu, 8 Aug 2013 14:37:19 +0800 Subject: [PATCH] ts: rk29_i2c_goodix: fix shutdown panic, prevent unregister_early_suspend before register_early_suspend --- drivers/input/touchscreen/rk29_i2c_goodix.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 } -- 2.34.1