Эх сурвалжийг харах

touch: raydium: NULL pointer panic from TOUCH driver

During Reboot,Cancel the work and destroy_workqueue and deallocate the
memory for g_raydium_ts in shutdown and remove callbacks.

Change-Id: I8ce1fa9814e3d85fde33d3241cec2f00755b9f06
Signed-off-by: Surya Teja Kudiri <[email protected]>
Surya Teja Kudiri 2 жил өмнө
parent
commit
1966defdcf
1 өөрчлөгдсөн 13 нэмэгдсэн , 6 устгасан
  1. 13 6
      raydium/raydium_driver.c

+ 13 - 6
raydium/raydium_driver.c

@@ -2512,6 +2512,10 @@ exit_check_functionality_failed:
 void raydium_ts_shutdown(struct i2c_client *client)
 {
 
+	if (g_raydium_ts->workqueue) {
+		destroy_workqueue(g_raydium_ts->workqueue);
+		g_raydium_ts->workqueue = NULL;
+	}
 #if defined(CONFIG_FB)
 	raydium_unregister_notifier();
 #elif defined(CONFIG_HAS_EARLYSUSPEND)
@@ -2541,18 +2545,22 @@ if (active_panel)
 	if (gpio_is_valid(g_raydium_ts->irq_gpio))
 		gpio_free(g_raydium_ts->irq_gpio);
 
-	cancel_work_sync(&g_raydium_ts->work);
-	destroy_workqueue(g_raydium_ts->workqueue);
-
 	raydium_enable_regulator(g_raydium_ts, false);
 	raydium_get_regulator(g_raydium_ts, false);
 
+	kfree(g_raydium_ts);
+
 	i2c_set_clientdata(client, NULL);
 }
 
 static int raydium_ts_remove(struct i2c_client *client)
 {
 
+        if (g_raydium_ts->workqueue) {
+                destroy_workqueue(g_raydium_ts->workqueue);
+                g_raydium_ts->workqueue = NULL;
+        }
+
 #if defined(CONFIG_FB)
 	raydium_unregister_notifier();
 #elif defined(CONFIG_HAS_EARLYSUSPEND)
@@ -2580,12 +2588,11 @@ if (active_panel)
 	if (gpio_is_valid(g_raydium_ts->irq_gpio))
 		gpio_free(g_raydium_ts->irq_gpio);
 
-	cancel_work_sync(&g_raydium_ts->work);
-	destroy_workqueue(g_raydium_ts->workqueue);
-
 	raydium_enable_regulator(g_raydium_ts, false);
 	raydium_get_regulator(g_raydium_ts, false);
 
+	kfree(g_raydium_ts);
+
 	i2c_set_clientdata(client, NULL);
 	return 0;
 }