From 3185db3d78e6cbd203fb027dc28dc67073778f2a Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Sun, 12 Jan 2014 10:58:12 +0100 Subject: S5C73M3: System firmware loading correction using static memory array Signed-off-by: Paul Kocialkowski --- drivers/media/video/s5c73m3.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/media/video/s5c73m3.c b/drivers/media/video/s5c73m3.c index e29b8cd..05450c4 100644 --- a/drivers/media/video/s5c73m3.c +++ b/drivers/media/video/s5c73m3.c @@ -2666,7 +2666,6 @@ static int s5c73m3_load_fw(struct v4l2_subdev *sd) const struct firmware *fw; char fw_path[20] = {0,}; char fw_path_in_data[25] = {0,}; - u8 *buf = NULL; int err = 0; int txSize = 0; @@ -2736,30 +2735,25 @@ static int s5c73m3_load_fw(struct v4l2_subdev *sd) } /*cam_dbg("start, size %d Bytes\n", fw->size);*/ - buf = (u8 *)fw->data; + memcpy((void *) &data_memory, (void *) fw->data, fw->size); fsize = fw->size; } txSize = 60*1024; /*60KB*/ - if (state->fw_index != S5C73M3_IN_SYSTEM) { - err = s5c73m3_spi_write((char *)&data_memory, - fsize, txSize); - if (err < 0) { - cam_err("s5c73m3_spi_write falied\n"); - goto out; - } - } else { - err = s5c73m3_spi_write((char *)buf, fsize, txSize); + err = s5c73m3_spi_write((char *)&data_memory, + fsize, txSize); + if (err < 0) { + cam_err("s5c73m3_spi_write falied\n"); + goto out; } + out: if (state->fw_index == S5C73M3_SD_CARD || state->fw_index == S5C73M3_IN_DATA) { if (!IS_ERR(fp) && fp != NULL) filp_close(fp, current->files); - vfree(buf); - set_fs(old_fs); } else { release_firmware(fw); -- cgit v1.1