Skip to content

Commit 59338cc

Browse files
committed
touchscreen: gt9xxnew: Fix "Error: Driver 'gt9xxnew_ts' is already registered, aborting..."
1 parent 09e8600 commit 59338cc

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
@@ -3283,6 +3283,7 @@ static int startup(void)
32833283
********************************************************/
32843284
static int goodix_ts_init(void)
32853285
{
3286+
int ret = 0;
32863287
#if !USE_DETECT
32873288
struct device_node *np = NULL;
32883289
char *p = NULL;
@@ -3313,11 +3314,20 @@ static int goodix_ts_init(void)
33133314
gtp_esd_check_workqueue = create_workqueue("gtp_esd_check");
33143315
#endif
33153316

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

33233333
/*******************************************************
@@ -3334,6 +3344,7 @@ static void __exit goodix_ts_exit(void)
33343344
i2c_del_driver(&goodix_ts_driver);
33353345
if (goodix_wq) {
33363346
destroy_workqueue(goodix_wq);
3347+
goodix_wq = NULL;
33373348
}
33383349
input_set_power_enable(&(config_info.input_type), 0);
33393350
input_sensor_free(&(config_info.input_type));

0 commit comments

Comments
 (0)