Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b3ba6ab7 authored by Shantanu Jain's avatar Shantanu Jain Committed by Gerrit - the friendly Code Review server
Browse files

input: touchscreen: Add devm_kzalloc calls to goodix driver



Change the kzalloc calls to devm_kzalloc calls to
avoid explicit kfree calls. Remove redundant kfree calls
to avoid double free. Fix error check path on devm_kzalloc
return values. Also remove redundant goto labels.

Change-Id: I62f0ff800318882067bc0f16b021cb344e340ecf
Signed-off-by: default avatarShantanu Jain <shjain@codeaurora.org>
Signed-off-by: default avatarSudhakar Manapati <smanap@codeaurora.org>
parent 452a316d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -205,8 +205,9 @@ s32 init_wr_node(struct i2c_client *client)

	i = 5;
	while ((!cmd_head.data) && i) {
		cmd_head.data = kzalloc(i * DATA_LENGTH_UINT, GFP_KERNEL);
		if (cmd_head.data != NULL)
		cmd_head.data = devm_kzalloc(&client->dev,
				i * DATA_LENGTH_UINT, GFP_KERNEL);
		if (cmd_head.data)
			break;
		i--;
	}
@@ -239,7 +240,6 @@ s32 init_wr_node(struct i2c_client *client)

void uninit_wr_node(void)
{
	kfree(cmd_head.data);
	cmd_head.data = NULL;
	unregister_i2c_func();
	remove_proc_entry(procname, NULL);
+1 −4
Original line number Diff line number Diff line
@@ -1641,7 +1641,7 @@ static int goodix_ts_probe(struct i2c_client *client,
		return -ENODEV;
	}

	ts = kzalloc(sizeof(*ts), GFP_KERNEL);
	ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL);
	if (!ts)
		return -ENOMEM;

@@ -1782,7 +1782,6 @@ exit_deinit_power:
	goodix_power_deinit(ts);
exit_free_client_data:
	i2c_set_clientdata(client, NULL);
	kfree(ts);
	return ret;
}

@@ -1831,7 +1830,6 @@ static int goodix_ts_remove(struct i2c_client *client)
			input_free_device(ts->input_dev);
			ts->input_dev = NULL;
		}
		kfree(ts->config_data);

		if (gpio_is_valid(ts->pdata->reset_gpio))
			gpio_free(ts->pdata->reset_gpio);
@@ -1841,7 +1839,6 @@ static int goodix_ts_remove(struct i2c_client *client)
		goodix_power_off(ts);
		goodix_power_deinit(ts);
		i2c_set_clientdata(client, NULL);
		kfree(ts);
	}

	return 0;
+82 −102
Original line number Diff line number Diff line
@@ -585,11 +585,11 @@ static u8 ascii2hex(u8 a)

static s8 gup_update_config(struct i2c_client *client)
{
	s32 file_len = 0;
	u32 file_len = 0;
	s32 ret = 0;
	s32 i = 0;
	s32 file_cfg_len = 0;
	s32 chip_cfg_len = 0;
	u32 chip_cfg_len = 0;
	s32 count = 0;
	u8 *buf;
	u8 *pre_buf;
@@ -625,9 +625,19 @@ static s8 gup_update_config(struct i2c_client *client)
		return -EINVAL;
	}

	buf = kzalloc(file_len, GFP_KERNEL);
	pre_buf = kzalloc(file_len, GFP_KERNEL);
	file_config = kzalloc(chip_cfg_len + GTP_ADDR_LENGTH, GFP_KERNEL);
	buf = devm_kzalloc(&client->dev, file_len, GFP_KERNEL);
	if (!buf)
		return -ENOMEM;

	pre_buf = devm_kzalloc(&client->dev, file_len, GFP_KERNEL);
	if (!pre_buf)
		return -ENOMEM;

	file_config = devm_kzalloc(&client->dev, chip_cfg_len + GTP_ADDR_LENGTH,
								GFP_KERNEL);
	if (!file_config)
		return -ENOMEM;

	update_msg.cfg_file->f_op->llseek(update_msg.cfg_file, 0, SEEK_SET);

	GTP_DEBUG("[update_cfg]Read config from file.");
@@ -635,7 +645,7 @@ static s8 gup_update_config(struct i2c_client *client)
			(char *)pre_buf, file_len, &update_msg.cfg_file->f_pos);
	if (ret < 0) {
		GTP_ERROR("[update_cfg]Read config file failed.");
		goto update_cfg_file_failed;
		return ret;
	}

	GTP_DEBUG("[update_cfg]Delete illegal character.");
@@ -660,13 +670,13 @@ static s8 gup_update_config(struct i2c_client *client)
			if ((high == 0xFF) || (low == 0xFF)) {
				ret = 0;
				GTP_ERROR("[update_cfg]Illegal config file.");
				goto update_cfg_file_failed;
				return ret;
			}
			file_config[file_cfg_len++] = (high<<4) + low;
		} else {
			ret = 0;
			GTP_ERROR("[update_cfg]Illegal config file.");
			goto update_cfg_file_failed;
			return ret;
		}
	}

@@ -690,10 +700,6 @@ static s8 gup_update_config(struct i2c_client *client)
		GTP_ERROR("[update_cfg]Send config i2c error.");
	}

update_cfg_file_failed:
	kfree(pre_buf);
	kfree(buf);
	kfree(file_config);
	return ret;
}

@@ -797,16 +803,22 @@ static u8 gup_check_update_file(struct i2c_client *client, st_fw_head *fw_head,
						sizeof(UPDATE_FILE_PATH_2));
		u8 cfp_len = max(sizeof(CONFIG_FILE_PATH_1),
						sizeof(CONFIG_FILE_PATH_2));
		u8 *search_update_path = kzalloc(fp_len, GFP_KERNEL);
		u8 *search_cfg_path = kzalloc(cfp_len, GFP_KERNEL);

		u8 *search_update_path = devm_kzalloc(&client->dev, fp_len,
							GFP_KERNEL);
		if (!search_update_path)
			goto load_failed;

		u8 *search_cfg_path = devm_kzalloc(&client->dev, cfp_len,
							GFP_KERNEL);
		if (!search_cfg_path)
			goto load_failed;
		/* Begin to search update file,the config file & firmware
		 *	file must be in the same path,single or double.
		 */
		searching_file = 1;
		for (i = 0; i < GUP_SEARCH_FILE_TIMES; i++) {
			if (searching_file == 0) {
				kfree(search_update_path);
				kfree(search_cfg_path);
				GTP_INFO(".bin/.cfg update file search ",
						"forcely terminated!");
				return FAIL;
@@ -853,8 +865,6 @@ static u8 gup_check_update_file(struct i2c_client *client, st_fw_head *fw_head,
		}

		searching_file = 0;
		kfree(search_update_path);
		kfree(search_cfg_path);

		if (!got_file_flag) {
			GTP_ERROR("Can't find update file.");
@@ -1178,7 +1188,8 @@ static u8 gup_burn_dsp_isp(struct i2c_client *client)
	/* step1:alloc memory */
	GTP_DEBUG("[burn_dsp_isp]step1:alloc memory");
	while (retry++ < 5) {
		fw_dsp_isp = kzalloc(FW_DSP_ISP_LENGTH, GFP_KERNEL);
		fw_dsp_isp = devm_kzalloc(&client->dev, FW_DSP_ISP_LENGTH,
								GFP_KERNEL);
		if (fw_dsp_isp == NULL) {
			continue;
		} else {
@@ -1187,7 +1198,7 @@ static u8 gup_burn_dsp_isp(struct i2c_client *client)
			break;
		}
	}
	if (retry >= 5) {
	if (retry == 5) {
		GTP_ERROR("[burn_dsp_isp]Alloc memory fail,exit.");
		return FAIL;
	}
@@ -1198,7 +1209,7 @@ static u8 gup_burn_dsp_isp(struct i2c_client *client)
		FW_DSP_LENGTH + FW_BOOT_LENGTH), FW_DSP_ISP_LENGTH);
	if (ret == FAIL) {
		GTP_ERROR("[burn_dsp_isp]load firmware dsp_isp fail.");
		goto exit_burn_dsp_isp;
		return FAIL;
	}

	/* step3:disable wdt,clear cache enable */
@@ -1206,14 +1217,12 @@ static u8 gup_burn_dsp_isp(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _bRW_MISCTL__TMR0_EN, 0x00);
	if (ret <= 0) {
		GTP_ERROR("[burn_dsp_isp]disable wdt fail.");
		ret = FAIL;
		goto exit_burn_dsp_isp;
		return FAIL;
	}
	ret = gup_set_ic_msg(client, _bRW_MISCTL__CACHE_EN, 0x00);
	if (ret <= 0) {
		GTP_ERROR("[burn_dsp_isp]clear cache enable fail.");
		ret = FAIL;
		goto exit_burn_dsp_isp;
		return FAIL;
	}

	/* step4:hold ss51 & dsp */
@@ -1221,8 +1230,7 @@ static u8 gup_burn_dsp_isp(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x0C);
	if (ret <= 0) {
		GTP_ERROR("[burn_dsp_isp]hold ss51 & dsp fail.");
		ret = FAIL;
		goto exit_burn_dsp_isp;
		return FAIL;
	}

	/* step5:set boot from sram */
@@ -1230,8 +1238,7 @@ static u8 gup_burn_dsp_isp(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOTCTL_B0_, 0x02);
	if (ret <= 0) {
		GTP_ERROR("[burn_dsp_isp]set boot from sram fail.");
		ret = FAIL;
		goto exit_burn_dsp_isp;
		return FAIL;
	}

	/* step6:software reboot */
@@ -1239,8 +1246,7 @@ static u8 gup_burn_dsp_isp(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _bWO_MISCTL__CPU_SWRST_PULSE, 0x01);
	if (ret <= 0) {
		GTP_ERROR("[burn_dsp_isp]software reboot fail.");
		ret = FAIL;
		goto exit_burn_dsp_isp;
		return FAIL;
	}

	/* step7:select bank2 */
@@ -1248,8 +1254,7 @@ static u8 gup_burn_dsp_isp(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _bRW_MISCTL__SRAM_BANK, 0x02);
	if (ret <= 0) {
		GTP_ERROR("[burn_dsp_isp]select bank2 fail.");
		ret = FAIL;
		goto exit_burn_dsp_isp;
		return FAIL;
	}

	/* step8:enable accessing code */
@@ -1257,8 +1262,7 @@ static u8 gup_burn_dsp_isp(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _bRW_MISCTL__MEM_CD_EN, 0x01);
	if (ret <= 0) {
		GTP_ERROR("[burn_dsp_isp]enable accessing code fail.");
		ret = FAIL;
		goto exit_burn_dsp_isp;
		return FAIL;
	}

	/* step9:burn 4k dsp_isp */
@@ -1266,7 +1270,7 @@ static u8 gup_burn_dsp_isp(struct i2c_client *client)
	ret = gup_burn_proc(client, fw_dsp_isp, 0xC000, FW_DSP_ISP_LENGTH);
	if (ret == FAIL) {
		GTP_ERROR("[burn_dsp_isp]burn dsp_isp fail.");
		goto exit_burn_dsp_isp;
		return FAIL;
	}

	/* step10:set scramble */
@@ -1274,14 +1278,10 @@ static u8 gup_burn_dsp_isp(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_OPT_B0_, 0x00);
	if (ret <= 0) {
		GTP_ERROR("[burn_dsp_isp]set scramble fail.");
		ret = FAIL;
		goto exit_burn_dsp_isp;
		return FAIL;
	}
	ret = SUCCESS;

exit_burn_dsp_isp:
	kfree(fw_dsp_isp);
	return ret;
	return SUCCESS;
}

static u8 gup_burn_fw_ss51(struct i2c_client *client)
@@ -1295,7 +1295,8 @@ static u8 gup_burn_fw_ss51(struct i2c_client *client)
	/* step1:alloc memory */
	GTP_DEBUG("[burn_fw_ss51]step1:alloc memory");
	while (retry++ < 5) {
		fw_ss51 = kzalloc(FW_SECTION_LENGTH, GFP_KERNEL);
		fw_ss51 = devm_kzalloc(&client->dev, FW_SECTION_LENGTH,
							GFP_KERNEL);
		if (fw_ss51 == NULL) {
			continue;
		} else {
@@ -1304,7 +1305,7 @@ static u8 gup_burn_fw_ss51(struct i2c_client *client)
			break;
		}
	}
	if (retry >= 5) {
	if (retry == 5) {
		GTP_ERROR("[burn_fw_ss51]Alloc memory fail,exit.");
		return FAIL;
	}
@@ -1314,7 +1315,7 @@ static u8 gup_burn_fw_ss51(struct i2c_client *client)
	ret = gup_load_section_file(fw_ss51, 0, FW_SECTION_LENGTH);
	if (ret == FAIL) {
		GTP_ERROR("[burn_fw_ss51]load ss51 firmware section 1 fail.");
		goto exit_burn_fw_ss51;
		return FAIL;
	}

	/* step3:clear control flag */
@@ -1322,8 +1323,7 @@ static u8 gup_burn_fw_ss51(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_CTL_, 0x00);
	if (ret <= 0) {
		GTP_ERROR("[burn_fw_ss51]clear control flag fail.");
		ret = FAIL;
		goto exit_burn_fw_ss51;
		return FAIL;
	}

	/* step4:burn ss51 firmware section 1 */
@@ -1331,7 +1331,7 @@ static u8 gup_burn_fw_ss51(struct i2c_client *client)
	ret = gup_burn_fw_section(client, fw_ss51, 0xC000, 0x01);
	if (ret == FAIL) {
		GTP_ERROR("[burn_fw_ss51]burn ss51 firmware section 1 fail.");
		goto exit_burn_fw_ss51;
		return FAIL;
	}

	/* step5:load ss51 firmware section 2 file data */
@@ -1340,7 +1340,7 @@ static u8 gup_burn_fw_ss51(struct i2c_client *client)
							FW_SECTION_LENGTH);
	if (ret == FAIL) {
		GTP_ERROR("[burn_fw_ss51]load ss51 firmware section 2 fail.");
		goto exit_burn_fw_ss51;
		return FAIL;
	}

	/* step6:burn ss51 firmware section 2 */
@@ -1348,7 +1348,7 @@ static u8 gup_burn_fw_ss51(struct i2c_client *client)
	ret = gup_burn_fw_section(client, fw_ss51, 0xE000, 0x02);
	if (ret == FAIL) {
		GTP_ERROR("[burn_fw_ss51]burn ss51 firmware section 2 fail.");
		goto exit_burn_fw_ss51;
		return FAIL;
	}

	/* step7:load ss51 firmware section 3 file data */
@@ -1357,7 +1357,7 @@ static u8 gup_burn_fw_ss51(struct i2c_client *client)
							FW_SECTION_LENGTH);
	if (ret == FAIL) {
		GTP_ERROR("[burn_fw_ss51]load ss51 firmware section 3 fail.");
		goto exit_burn_fw_ss51;
		return FAIL;
	}

	/* step8:burn ss51 firmware section 3 */
@@ -1365,7 +1365,7 @@ static u8 gup_burn_fw_ss51(struct i2c_client *client)
	ret = gup_burn_fw_section(client, fw_ss51, 0xC000, 0x13);
	if (ret == FAIL) {
		GTP_ERROR("[burn_fw_ss51]burn ss51 firmware section 3 fail.");
		goto exit_burn_fw_ss51;
		return FAIL;
	}

	/* step9:load ss51 firmware section 4 file data */
@@ -1374,7 +1374,7 @@ static u8 gup_burn_fw_ss51(struct i2c_client *client)
							FW_SECTION_LENGTH);
	if (ret == FAIL) {
		GTP_ERROR("[burn_fw_ss51]load ss51 firmware section 4 fail.");
		goto exit_burn_fw_ss51;
		return FAIL;
	}

	/* step10:burn ss51 firmware section 4 */
@@ -1382,14 +1382,10 @@ static u8 gup_burn_fw_ss51(struct i2c_client *client)
	ret = gup_burn_fw_section(client, fw_ss51, 0xE000, 0x14);
	if (ret == FAIL) {
		GTP_ERROR("[burn_fw_ss51]burn ss51 firmware section 4 fail.");
		goto exit_burn_fw_ss51;
		return FAIL;
	}

	ret = SUCCESS;

exit_burn_fw_ss51:
	kfree(fw_ss51);
	return ret;
	return SUCCESS;
}

static u8 gup_burn_fw_dsp(struct i2c_client *client)
@@ -1403,7 +1399,8 @@ static u8 gup_burn_fw_dsp(struct i2c_client *client)
	/* step1:alloc memory */
	GTP_DEBUG("[burn_fw_dsp]step1:alloc memory");
	while (retry++ < 5) {
		fw_dsp = kzalloc(FW_DSP_LENGTH, GFP_KERNEL);
		fw_dsp = devm_kzalloc(&client->dev, FW_DSP_LENGTH,
							GFP_KERNEL);
		if (fw_dsp == NULL) {
			continue;
		} else  {
@@ -1412,7 +1409,7 @@ static u8 gup_burn_fw_dsp(struct i2c_client *client)
			break;
		}
	}
	if (retry >= 5) {
	if (retry == 5) {
		GTP_ERROR("[burn_fw_dsp]Alloc memory fail,exit.");
		return FAIL;
	}
@@ -1422,7 +1419,7 @@ static u8 gup_burn_fw_dsp(struct i2c_client *client)
	ret = gup_load_section_file(fw_dsp, 4*FW_SECTION_LENGTH, FW_DSP_LENGTH);
	if (ret == FAIL) {
		GTP_ERROR("[burn_fw_dsp]load firmware dsp fail.");
		goto exit_burn_fw_dsp;
		return ret;
	}

	/* step3:select bank3 */
@@ -1430,8 +1427,7 @@ static u8 gup_burn_fw_dsp(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _bRW_MISCTL__SRAM_BANK, 0x03);
	if (ret <= 0) {
		GTP_ERROR("[burn_fw_dsp]select bank3 fail.");
		ret = FAIL;
		goto exit_burn_fw_dsp;
		return FAIL;
	}

	/* Step4:hold ss51 & dsp */
@@ -1439,8 +1435,7 @@ static u8 gup_burn_fw_dsp(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x0C);
	if (ret <= 0) {
		GTP_ERROR("[burn_fw_dsp]hold ss51 & dsp fail.");
		ret = FAIL;
		goto exit_burn_fw_dsp;
		return FAIL;
	}

	/* step5:set scramble */
@@ -1448,8 +1443,7 @@ static u8 gup_burn_fw_dsp(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_OPT_B0_, 0x00);
	if (ret <= 0) {
		GTP_ERROR("[burn_fw_dsp]set scramble fail.");
		ret = FAIL;
		goto exit_burn_fw_dsp;
		return FAIL;
	}

	/* step6:release ss51 & dsp */
@@ -1457,8 +1451,7 @@ static u8 gup_burn_fw_dsp(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x04);
	if (ret <= 0) {
		GTP_ERROR("[burn_fw_dsp]release ss51 & dsp fail.");
		ret = FAIL;
		goto exit_burn_fw_dsp;
		return FAIL;
	}
	/* must delay */
	msleep(20);
@@ -1468,7 +1461,7 @@ static u8 gup_burn_fw_dsp(struct i2c_client *client)
	ret = gup_burn_proc(client, fw_dsp, 0x9000, FW_DSP_LENGTH);
	if (ret == FAIL) {
		GTP_ERROR("[burn_fw_dsp]burn fw_section fail.");
		goto exit_burn_fw_dsp;
		return ret;
	}

	/* step8:send burn cmd to move data to flash from sram */
@@ -1477,14 +1470,14 @@ static u8 gup_burn_fw_dsp(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_CTL_, 0x05);
	if (ret <= 0) {
		GTP_ERROR("[burn_fw_dsp]send burn cmd fail.");
		goto exit_burn_fw_dsp;
		return ret;
	}
	GTP_DEBUG("[burn_fw_dsp]Wait for the burn is complete......");
	do {
		ret = gup_get_ic_msg(client, _rRW_MISCTL__BOOT_CTL_, rd_buf, 1);
		if (ret <= 0) {
			GTP_ERROR("[burn_fw_dsp]Get burn state fail");
			goto exit_burn_fw_dsp;
			return ret;
		}
		msleep(20);
		/* GTP_DEBUG("[burn_fw_dsp]Get burn state:%d.",
@@ -1497,14 +1490,10 @@ static u8 gup_burn_fw_dsp(struct i2c_client *client)
	ret = gup_recall_check(client, fw_dsp, 0x9000, FW_DSP_LENGTH);
	if (ret == FAIL) {
		GTP_ERROR("[burn_fw_dsp]recall check 4k dsp firmware fail.");
		goto exit_burn_fw_dsp;
		return ret;
	}

	ret = SUCCESS;

exit_burn_fw_dsp:
	kfree(fw_dsp);
	return ret;
}

static u8 gup_burn_fw_boot(struct i2c_client *client)
@@ -1519,7 +1508,8 @@ static u8 gup_burn_fw_boot(struct i2c_client *client)
	/* step1:Alloc memory */
	GTP_DEBUG("[burn_fw_boot]step1:Alloc memory");
	while (retry++ < 5) {
		fw_boot = kzalloc(FW_BOOT_LENGTH, GFP_KERNEL);
		fw_boot = devm_kzalloc(&client->dev, FW_BOOT_LENGTH,
							GFP_KERNEL);
		if (fw_boot == NULL) {
			continue;
		} else {
@@ -1528,7 +1518,7 @@ static u8 gup_burn_fw_boot(struct i2c_client *client)
			break;
		}
	}
	if (retry >= 5) {
	if (retry == 5) {
		GTP_ERROR("[burn_fw_boot]Alloc memory fail,exit.");
		return FAIL;
	}
@@ -1539,7 +1529,7 @@ static u8 gup_burn_fw_boot(struct i2c_client *client)
				FW_DSP_LENGTH), FW_BOOT_LENGTH);
	if (ret == FAIL) {
		GTP_ERROR("[burn_fw_boot]load firmware dsp fail.");
		goto exit_burn_fw_boot;
		return ret;
	}

	/* step3:hold ss51 & dsp */
@@ -1547,8 +1537,7 @@ static u8 gup_burn_fw_boot(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x0C);
	if (ret <= 0) {
		GTP_ERROR("[burn_fw_boot]hold ss51 & dsp fail.");
		ret = FAIL;
		goto exit_burn_fw_boot;
		return FAIL;
	}

	/* step4:set scramble */
@@ -1556,8 +1545,7 @@ static u8 gup_burn_fw_boot(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_OPT_B0_, 0x00);
	if (ret <= 0) {
		GTP_ERROR("[burn_fw_boot]set scramble fail.");
		ret = FAIL;
		goto exit_burn_fw_boot;
		return FAIL;
	}

	/* step5:release ss51 & dsp */
@@ -1565,8 +1553,7 @@ static u8 gup_burn_fw_boot(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x04);
	if (ret <= 0) {
		GTP_ERROR("[burn_fw_boot]release ss51 & dsp fail.");
		ret = FAIL;
		goto exit_burn_fw_boot;
		return FAIL;
	}
	/* must delay */
	msleep(20);
@@ -1576,8 +1563,7 @@ static u8 gup_burn_fw_boot(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _bRW_MISCTL__SRAM_BANK, 0x03);
	if (ret <= 0) {
		GTP_ERROR("[burn_fw_boot]select bank3 fail.");
		ret = FAIL;
		goto exit_burn_fw_boot;
		return FAIL;
	}

	/* step7:burn 2k bootloader firmware */
@@ -1585,7 +1571,7 @@ static u8 gup_burn_fw_boot(struct i2c_client *client)
	ret = gup_burn_proc(client, fw_boot, 0x9000, FW_BOOT_LENGTH);
	if (ret == FAIL) {
		GTP_ERROR("[burn_fw_boot]burn fw_section fail.");
		goto exit_burn_fw_boot;
		return ret;
	}

	/* step7:send burn cmd to move data to flash from sram */
@@ -1594,14 +1580,14 @@ static u8 gup_burn_fw_boot(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_CTL_, 0x06);
	if (ret <= 0) {
		GTP_ERROR("[burn_fw_boot]send burn cmd fail.");
		goto exit_burn_fw_boot;
		return ret;
	}
	GTP_DEBUG("[burn_fw_boot]Wait for the burn is complete......");
	do {
		ret = gup_get_ic_msg(client, _rRW_MISCTL__BOOT_CTL_, rd_buf, 1);
		if (ret <= 0) {
			GTP_ERROR("[burn_fw_boot]Get burn state fail");
			goto exit_burn_fw_boot;
			return ret;
		}
		msleep(20);
		/* GTP_DEBUG("[burn_fw_boot]Get burn state:%d.",
@@ -1614,7 +1600,7 @@ static u8 gup_burn_fw_boot(struct i2c_client *client)
	ret = gup_recall_check(client, fw_boot, 0x9000, FW_BOOT_LENGTH);
	if (ret == FAIL) {
		GTP_ERROR("[burn_fw_boot]recall check 4k dsp firmware fail.");
		goto exit_burn_fw_boot;
		return ret;
	}

	/* step9:enable download DSP code  */
@@ -1622,8 +1608,7 @@ static u8 gup_burn_fw_boot(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_CTL_, 0x99);
	if (ret <= 0) {
		GTP_ERROR("[burn_fw_boot]enable download DSP code fail.");
		ret = FAIL;
		goto exit_burn_fw_boot;
		return FAIL;
	}

	/* step10:release ss51 & hold dsp */
@@ -1631,15 +1616,10 @@ static u8 gup_burn_fw_boot(struct i2c_client *client)
	ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x08);
	if (ret <= 0) {
		GTP_ERROR("[burn_fw_boot]release ss51 & hold dsp fail.");
		ret = FAIL;
		goto exit_burn_fw_boot;
		return FAIL;
	}

	ret = SUCCESS;

exit_burn_fw_boot:
	kfree(fw_boot);
	return ret;
	return SUCCESS;
}

s32 gup_update_proc(void *dir)