@@ -2962,6 +2962,8 @@ static int mxt_initialize_input_device(struct mxt_data *data)
goto err_free_mem;
}
+ data->input_dev = input_dev;
+
if (data->gpio_attrs.attrs) {
error = sysfs_create_group(&input_dev->dev.kobj,
&data->gpio_attrs);
@@ -2972,11 +2974,10 @@ static int mxt_initialize_input_device(struct mxt_data *data)
}
}
- data->input_dev = input_dev;
-
return 0;
err_free_mem:
+ data->input_dev = NULL;
input_free_device(input_dev);
return error;
}
@@ -4597,13 +4598,6 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
msleep(MXT_RESET_TIME);
}
- error = sysfs_create_group(&client->dev.kobj, &mxt_fw_attr_group);
- if (error) {
- dev_err(&client->dev, "Failure %d creating fw sysfs group\n",
- error);
- return error;
- }
-
INIT_WORK(&data->watchdog_work, mxt_watchdog_work);
/* setup watchdog timer */
@@ -4613,11 +4607,18 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
error = mxt_initialize(data);
if (error)
- goto err_free_object;
+ goto err_del_wd_timer;
+
+ error = sysfs_create_group(&client->dev.kobj, &mxt_fw_attr_group);
+ if (error) {
+ dev_err(&client->dev, "Failure %d creating fw sysfs group\n",
+ error);
+ goto err_del_wd_timer;
+ }
return 0;
-err_free_object:
+err_del_wd_timer:
cancel_work_sync(&data->watchdog_work);
mxt_stop_wd_timer(data);
mxt_free_input_device(data);