From mboxrd@z Thu Jan 1 00:00:00 1970 From: Detlev Zundel Date: Fri, 17 Feb 2012 15:15:21 +0100 Subject: [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed In-Reply-To: <1328807702-28146-1-git-send-email-walle@corscience.de> (Bernhard Walle's message of "Thu, 9 Feb 2012 18:15:02 +0100") References: <1328807702-28146-1-git-send-email-walle@corscience.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Bernhard, > In addition to the error message also display the error code. I had the > problem that my malloc memory was not enough (ENOMEM), and if u-boot > had displayed the error code immediately that would have saved me some > debugging. > > Signed-off-by: Bernhard Walle > --- > fs/ubifs/super.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c > index 26b48f0..0b1440b 100644 > --- a/fs/ubifs/super.c > +++ b/fs/ubifs/super.c > @@ -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. Cheers Detlev -- The fact is, volatile on data structures is a bug. It's a wart in the C language. It shouldn't be used. -- Linus Torvalds -- 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