[U-Boot] [PATCH 4/7] JFFS2: Improve error checking

Baidu Liu liucai.lfn at gmail.com
Fri Apr 29 17:02:18 CEST 2011


Hi, Detlev


>> @@ -1470,9 +1471,16 @@ jffs2_1pass_build_lists(struct part_info * part)
>>       /* lcd_off(); */
>>
>>       /* if we are building a list we need to refresh the cache. */
>> -     jffs_init_1pass_list(part);
>> +     if(! jffs_init_1pass_list(part))
>> +             return 0;
>> +
>
> This is strange.  We now check for an error of jffs2_init_1pass_list,
> which currently always returns 0, so let's see where you change that.
> Ah, you don't (it's in line 671 in this file).  It's only in
> jffs2_nand_1pass that you do a change, but even there we have a problem:
Yes, we check the return value of function jffs_init_1pass_list().
Also we add the check in nand flash.
I do not konw what you are talking about.

>> diff --git a/fs/jffs2/jffs2_nand_1pass.c b/fs/jffs2/jffs2_nand_1pass.c
>> index 9bad690..885fa3c 100644
>> --- a/fs/jffs2/jffs2_nand_1pass.c
>> +++ b/fs/jffs2/jffs2_nand_1pass.c
>> @@ -251,6 +251,7 @@ jffs_init_1pass_list(struct part_info *part)
>>               pL->dir.listCompare = compare_dirents;
>>               pL->frag.listCompare = compare_inodes;
>>  #endif
>> +             return 1;
>
> When malloc fails, we get no error output.
You are too strict. Search the malloc in uboot. There are many places which
do not even check the return value.


More information about the U-Boot mailing list