Avoid data abort if we fail to find flash

From: Ken Gordon (ken@magneticscrolls.com)
Date: Wed Oct 09 2002 - 06:24:11 EDT


OK. At the moment my boorldr fails to identify my flash. As a result
flashDescriptor is NULL when we get to params_eval_file (whatever that is
for) and so it dies. This patch avoids death there and so my bootldr limps
to a boot> prompt which I think is an improvement.

    Ken

diff -u ../bootldr/jffs2_commands.c .
--- ../bootldr/jffs2_commands.c Wed Aug 21 19:27:45 2002
+++ ./jffs2_commands.c Wed Oct 9 11:01:58 2002
@@ -41,6 +41,10 @@
     unsigned long bootldr_size ;
     unsigned long bootldr_end ;

+ if (!flashDescriptor) {
+ putstr("flashDescriptor is NULL!\r\n");
+ return;
+ }

     bootldr_size = flashDescriptor->bootldr.size;
     bootldr_end = flashDescriptor->bootldr.base + bootldr_size;
@@ -54,14 +58,13 @@
     tmpPart = btflash_get_partition(TMP_PARTITION_NAME);

     part.offset = ((char *) flashword) + tmpPart->base;
+
     part.erasesize = flashDescriptor->sectors[1] -
flashDescriptor->sectors[0];
     part.size = tmpPart->size;

     putLabeledWord("params_eval_file: tmpPart->base =",tmpPart->base);
     putLabeledWord("params_eval_file: tmpPart->size =",tmpPart->size);

-
-
     size = jffs2_1pass_load(kernel_in_ram,&part,"/boot/params");

     putLabeledWord("pef: loaded a file of size ",size);



This archive was generated by hypermail 2.1.5 : Fri Jan 17 2003 - 17:47:04 EST