Skip to content

Commit d6c0581

Browse files
committed
touchscreen: gt9xxnew: Fix "Error: Driver 'gt9xxnew_ts' is already registered, aborting..."
1 parent 77b7e58 commit d6c0581

File tree

1 file changed

+16
-5
lines changed
  • drivers/input/touchscreen/gt9xxnew

1 file changed

+16
-5
lines changed

drivers/input/touchscreen/gt9xxnew/gt9xx.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3282,6 +3282,7 @@ static int startup(void)
32823282
********************************************************/
32833283
static int goodix_ts_init(void)
32843284
{
3285+
int ret = 0;
32853286
#if !USE_DETECT
32863287
struct device_node *np = NULL;
32873288
char *p = NULL;
@@ -3312,11 +3313,20 @@ static int goodix_ts_init(void)
33123313
gtp_esd_check_workqueue = create_workqueue("gtp_esd_check");
33133314
#endif
33143315

3315-
i2c_add_driver(&goodix_ts_driver);
3316-
if (config_info.probed)
3317-
return 0;
3318-
else
3319-
return -1;
3316+
ret = i2c_add_driver(&goodix_ts_driver);
3317+
if ((!ret) && (!config_info.probed))
3318+
ret = -1;
3319+
if (ret)
3320+
goto err_register;
3321+
return 0;
3322+
3323+
err_register:
3324+
i2c_del_driver(&goodix_ts_driver);
3325+
if (goodix_wq) {
3326+
destroy_workqueue(goodix_wq);
3327+
goodix_wq = NULL;
3328+
}
3329+
return ret;
33203330
}
33213331

33223332
/*******************************************************
@@ -3333,6 +3343,7 @@ static void __exit goodix_ts_exit(void)
33333343
i2c_del_driver(&goodix_ts_driver);
33343344
if (goodix_wq) {
33353345
destroy_workqueue(goodix_wq);
3346+
goodix_wq = NULL;
33363347
}
33373348
input_set_power_enable(&(config_info.input_type), 0);
33383349
input_sensor_free(&(config_info.input_type));

0 commit comments

Comments
 (0)