diff options
-rw-r--r-- | samsung-ipc/crespo_ipc.c | 2 | ||||
-rw-r--r-- | samsung-ipc/util.c | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/samsung-ipc/crespo_ipc.c b/samsung-ipc/crespo_ipc.c index 37209bc..1aaad4a 100644 --- a/samsung-ipc/crespo_ipc.c +++ b/samsung-ipc/crespo_ipc.c @@ -260,6 +260,8 @@ boot_loop_start: printf("crespo_ipc_bootstrap: write nv_data to modem_ctl\n"); nv_data_p = file_read("/efs/nv_data.bin", NV_DATA_SIZE, 1024); + if (nv_data_p == NULL) + goto error; data_p = nv_data_p; lseek(modem_ctl_fd, RADIO_IMG_SIZE, SEEK_SET); diff --git a/samsung-ipc/util.c b/samsung-ipc/util.c index 197a939..e7692d4 100644 --- a/samsung-ipc/util.c +++ b/samsung-ipc/util.c @@ -185,6 +185,10 @@ void *file_read(char *file_name, int size, int block_size) printf("file_read: reading 0x%x bytes from %s with 0x%x bytes block size\n", size, file_name, block_size); + fd=open(file_name, O_RDONLY); + if(fd < 0) + goto error; + file_p=malloc(size); if(file_p == NULL) goto error; @@ -193,10 +197,6 @@ void *file_read(char *file_name, int size, int block_size) data_p=(uint8_t *) file_p; - fd=open(file_name, O_RDONLY); - if(fd < 0) - goto error; - for(i=0 ; i < size / block_size ; i++) { read(fd, data_p, block_size); |