aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc
diff options
context:
space:
mode:
authorSimon Busch <morphis@gravedo.de>2011-10-12 15:17:16 +0200
committerSimon Busch <morphis@gravedo.de>2011-10-12 15:17:16 +0200
commit2a02cc87ad7872d7a3c845b634b957e51764eb2b (patch)
tree368db50a182a3b3645f0610f11f21156d7eedd7a /samsung-ipc
parent0fa1f15d0e68db899255b3a7b0eee6ac338869ad (diff)
downloadexternal_libsamsung-ipc-2a02cc87ad7872d7a3c845b634b957e51764eb2b.zip
external_libsamsung-ipc-2a02cc87ad7872d7a3c845b634b957e51764eb2b.tar.gz
external_libsamsung-ipc-2a02cc87ad7872d7a3c845b634b957e51764eb2b.tar.bz2
crespo: fixup reading radio image from mtd on bootstrap
It is important the user knows about the case when reading the radio image failed. So we check now the return value, try to read the image from a alternate path and then fail correctly. Signed-off-by: Simon Busch <morphis@gravedo.de>
Diffstat (limited to 'samsung-ipc')
-rw-r--r--samsung-ipc/crespo_ipc.c5
-rw-r--r--samsung-ipc/util.c9
2 files changed, 9 insertions, 5 deletions
diff --git a/samsung-ipc/crespo_ipc.c b/samsung-ipc/crespo_ipc.c
index d7ba8b4..37209bc 100644
--- a/samsung-ipc/crespo_ipc.c
+++ b/samsung-ipc/crespo_ipc.c
@@ -89,6 +89,11 @@ boot_loop_start:
/* Read the radio.img image. */
printf("crespo_ipc_bootstrap: reading radio image\n");
radio_img_p=mtd_read("/dev/mtd/mtd5ro", RADIO_IMG_SIZE, 0x1000);
+ if (radio_img_p == NULL) {
+ radio_img_p = mtd_read("/dev/mtd5ro", RADIO_IMG_SIZE, 0x1000);
+ if (radio_img_p == NULL)
+ goto error;
+ }
printf("crespo_ipc_bootstrap: radio image read\n");
printf("crespo_ipc_bootstrap: open modem_ctl\n");
diff --git a/samsung-ipc/util.c b/samsung-ipc/util.c
index 8d943a1..197a939 100644
--- a/samsung-ipc/util.c
+++ b/samsung-ipc/util.c
@@ -138,6 +138,10 @@ void *mtd_read(char *mtd_name, int size, int block_size)
printf("mtd_read: reading 0x%x bytes from %s with 0x%x bytes block size\n", size, mtd_name, block_size);
+ fd=open(mtd_name, O_RDONLY);
+ if(fd < 0)
+ goto error;
+
mtd_p=malloc(size);
if(mtd_p == NULL)
goto error;
@@ -146,10 +150,6 @@ void *mtd_read(char *mtd_name, int size, int block_size)
data_p=(uint8_t *) mtd_p;
- fd=open(mtd_name, O_RDONLY);
- if(fd < 0)
- goto error;
-
for(i=0 ; i < size / block_size ; i++)
{
offs = i * block_size;
@@ -169,7 +169,6 @@ void *mtd_read(char *mtd_name, int size, int block_size)
return mtd_p;
error:
- printf("%s: something went wrong\n", __func__);
return NULL;
}