public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Tormod Volden <lists.tormod@gmail.com>
To: linux-mtd@lists.infradead.org
Cc: Vikram Narayanan <vikram186@gmail.com>
Subject: [PATCH v2] mtd/nand: Print source of error message
Date: Sat, 12 Jan 2013 11:34:27 +0100	[thread overview]
Message-ID: <1357986867-22396-1-git-send-email-lists.tormod@gmail.com> (raw)
In-Reply-To: <50F12660.6010208@gmail.com>

From: Tormod Volden <debian.tormod@gmail.com>

Add the function name to the error message.

These messages are not very helpful:

[183356.176682] uncorrectable error :
[183356.180273] uncorrectable error :
[183356.184194] uncorrectable error :
[183356.187773] uncorrectable error :
[183356.191280] uncorrectable error :

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
---

Vikram Narayanan wrote:
> Better to use %s and __func__.
> Despite adding the function name, it'd be much better to briefly convey
> what has happened.

Hi Vikram,

I agree. I also replaced printk with pr_err which seems to be preferred
nowadays.

Sorry I can not help much with the better solution since I don't know this
code. The function is called via function pointers so it is not straight-
forward to find all callers and check their code.

Regards,
Tormod


 drivers/mtd/nand/nand_ecc.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/nand_ecc.c b/drivers/mtd/nand/nand_ecc.c
index b7cfe0d..526fa3b 100644
--- a/drivers/mtd/nand/nand_ecc.c
+++ b/drivers/mtd/nand/nand_ecc.c
@@ -55,8 +55,7 @@ struct mtd_info;
 #define MODULE_AUTHOR(x)	/* x */
 #define MODULE_DESCRIPTION(x)	/* x */
 
-#define printk printf
-#define KERN_ERR		""
+#define pr_err printf
 #endif
 
 /*
@@ -507,7 +506,7 @@ int __nand_correct_data(unsigned char *buf,
 	if ((bitsperbyte[b0] + bitsperbyte[b1] + bitsperbyte[b2]) == 1)
 		return 1;	/* error in ECC data; no action needed */
 
-	printk(KERN_ERR "uncorrectable error : ");
+	pr_err("%s: uncorrectable error : ", __func__);
 	return -1;
 }
 EXPORT_SYMBOL(__nand_correct_data);
-- 
1.7.9.5

  reply	other threads:[~2013-01-12 10:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-11 23:43 [PATCH] mtd: nand: print source of "uncorrectable error" message Tormod Volden
2013-01-12  9:01 ` Vikram Narayanan
2013-01-12 10:34   ` Tormod Volden [this message]
2013-01-17 13:56     ` [PATCH v2] mtd/nand: Print source of error message Artem Bityutskiy
2013-01-17 22:58       ` Tormod Volden
2013-01-18 10:18         ` Artem Bityutskiy

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=1357986867-22396-1-git-send-email-lists.tormod@gmail.com \
    --to=lists.tormod@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=vikram186@gmail.com \
    /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