From 80dd4267f644c7ba9657df52f6bce42f0bef1b4e Mon Sep 17 00:00:00 2001 From: Andrew Chant Date: Wed, 14 Sep 2016 15:25:23 -0700 Subject: [PATCH] input: synaptics: defer sysfs creation during init sysfs entries are created which reference fwu->fwu_work. defer the creation of these sysfs entries until the end of the init function, after fwu->fwu_work has been initialized. Change-Id: Ib7d5304ec2990454486e2b1d28b640a174c83d12 Bug: 31252388 Signed-off-by: Andrew Chant --- drivers/input/touchscreen/synaptics_fw_update.c | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/input/touchscreen/synaptics_fw_update.c b/drivers/input/touchscreen/synaptics_fw_update.c index 170a202590ad4..79b3a780550b8 100644 --- a/drivers/input/touchscreen/synaptics_fw_update.c +++ b/drivers/input/touchscreen/synaptics_fw_update.c @@ -2325,7 +2325,20 @@ static int synaptics_rmi4_fwu_init(struct synaptics_rmi4_data *rmi4_data) fwu->initialized = true; fwu->polling_mode = false; - retval = sysfs_create_bin_file(&rmi4_data->i2c_client->dev.kobj, + fwu->ts_info = kzalloc(RMI4_INFO_MAX_LEN, GFP_KERNEL); + if (!fwu->ts_info) { + dev_err(&rmi4_data->i2c_client->dev, "Not enough memory\n"); + goto exit_free_ts_info; + } + + synaptics_rmi4_update_debug_info(); + +#ifdef INSIDE_FIRMWARE_UPDATE + fwu->fwu_workqueue = create_singlethread_workqueue("fwu_workqueue"); + INIT_DELAYED_WORK(&fwu->fwu_work, synaptics_rmi4_fwu_work); +#endif + + retval = sysfs_create_bin_file(&rmi4_data->i2c_client->dev.kobj, &dev_attr_data); if (retval < 0) { dev_err(&rmi4_data->i2c_client->dev, @@ -2357,19 +2370,6 @@ static int synaptics_rmi4_fwu_init(struct synaptics_rmi4_data *rmi4_data) goto exit_remove_attrs; } - fwu->ts_info = kzalloc(RMI4_INFO_MAX_LEN, GFP_KERNEL); - if (!fwu->ts_info) { - dev_err(&rmi4_data->i2c_client->dev, "Not enough memory\n"); - goto exit_free_ts_info; - } - - synaptics_rmi4_update_debug_info(); - -#ifdef INSIDE_FIRMWARE_UPDATE - fwu->fwu_workqueue = create_singlethread_workqueue("fwu_workqueue"); - INIT_DELAYED_WORK(&fwu->fwu_work, synaptics_rmi4_fwu_work); -#endif - return 0; exit_free_ts_info: debugfs_remove(temp);