From: Detlev Zundel <dzu@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/7] JFFS2: Improve error checking
Date: Fri, 29 Apr 2011 19:31:47 +0200 [thread overview]
Message-ID: <m2tydh2ccc.fsf@ohwell.denx.de> (raw)
In-Reply-To: <BANLkTi=BD+i5s-R1i0SctRNG69ZmBA7GWA@mail.gmail.com> (Baidu Liu's message of "Fri, 29 Apr 2011 23:02:18 +0800")
Hi Baidu,
> 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.
The function 'jffs_init_1pass_list' is implemented in two files, i.e. in
fs/jffs2/jffs2_1pass.c and in fs/jffs2/jffs2_nand_1pass.c. Your patch
inserts the actual malloc error checking only in the latter file,
whereas the check for return code is done in both files. Just look at
your changes - how could your new test in jffs2_1pass ever fail as you
did not change the called function?
This is _plain inconsistent_ - you missed to do the same error checking
for the NOR flash case.
>>> 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.
This is getting more and more ridiculous. When writing new code, we
always have to conform to our own standards. Now you insert an error
check but if it fails, you do not inform the user that he ran out of
memory but simply provide empty output? So there is _no way_ of telling
a failed malloc from an empty directory? And to argument for this
broken behavious you point to other places that do no error checking?
Sorry, you are loosing my interest of reviewing your code.
Best wishes
Detlev
--
Peace of mind isn't at all superficial to technical work. It's the
whole thing. That which produces it is good work and that which
destroys it is bad work.
-- Robert M. Pirsig
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
prev parent reply other threads:[~2011-04-29 17:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-24 3:37 [U-Boot] [PATCH 4/7] JFFS2: Improve error checking Baidu Liu
2011-04-29 13:18 ` Detlev Zundel
2011-04-29 15:02 ` Baidu Liu
2011-04-29 17:31 ` Detlev Zundel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2tydh2ccc.fsf@ohwell.denx.de \
--to=dzu@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox