public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Detlev Zundel <dzu@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed
Date: Fri, 17 Feb 2012 16:00:11 +0100	[thread overview]
Message-ID: <m2zkchwlms.fsf@ohwell.denx.de> (raw)
In-Reply-To: <20120217143110.GA32414@agamemnon.er.corscience.de> (Bernhard Walle's message of "Fri, 17 Feb 2012 15:31:10 +0100")

Hi Bernhard,

> Hi Detlev,
>
> * Detlev Zundel <dzu@denx.de> [2012-02-17 15:15]:
>> 
>> > @@ -1191,7 +1191,7 @@ int ubifs_mount(char *vol_name)
>> >  	mnt = NULL;
>> >  	ret = ubifs_get_sb(&ubifs_fs_type, flags, name, data, mnt);
>> >  	if (ret) {
>> > -		printf("Error reading superblock on volume '%s'!\n", name);
>> > +		printf("Error reading superblock on volume '%s': %d!\n", name, -ret);
>> >  		return -1;
>> >  	}
>> 
>> I think this makes sense, but I think it would be more natural to print
>> the real error code, not the negative value.  I don't know how to search
>> for all such occurrences, but I cannot find any but a lot of sites
>> printing the error code as is.
>
> well, the return value is negative, so my intention was to print the
> error code as positive number. So you think we should display it as
> negative number (-12 instead of 12 for ENOMEM)?

Personally I believe that any transformation in the printing can mislead
people in the search for the cause or the responsible code.

So if the error value is -12, then we should print it.  After all, the
assignment to generate that value will very likely be "return -ENOMEM"
and people will thus know what to look for.

On the other hand I am open to the consistency argument, so if every
error printing would do such a transformation then it would be better to
also do it.  But as I said, I don't know an easy grep pattern to search
for such locations and quick searches showed that I all places I found
print the error codes unmangeld.

Cheers
  Detlev

-- 
Basically,  Barnes & Noble separates things by how old they are  -- current
stuff is "Fiction", stuff from 20 years ago is "Literature", stuff from 100
years ago is "Classics", stuff from 400 years ago is "Shakespeare" [..] and
stuff from 2000 years ago is "History".
                     -- James "Kibo" Parry in <kibo-1207032212000001@10.0.1.2>
--
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

  reply	other threads:[~2012-02-17 15:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09 17:15 [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed Bernhard Walle
2012-02-17 14:15 ` Detlev Zundel
2012-02-17 14:31   ` Bernhard Walle
2012-02-17 15:00     ` Detlev Zundel [this message]
2012-02-20  8:44     ` Bernhard Walle
2012-02-20  8:59       ` Albert ARIBAUD
2012-02-20  9:11         ` Bernhard Walle
2012-02-20 10:01           ` Albert ARIBAUD
2012-04-02 11:58             ` Thomas Weber
2012-05-15 20:33               ` Thomas Weber
2012-08-09 20:12               ` Wolfgang Denk

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=m2zkchwlms.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