From patchwork Sat Jan 12 10:34:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v2] mtd/nand: Print source of error message From: Tormod Volden X-Patchwork-Id: 211487 Message-Id: <1357986867-22396-1-git-send-email-lists.tormod@gmail.com> To: linux-mtd@lists.infradead.org Cc: Vikram Narayanan Date: Sat, 12 Jan 2013 11:34:27 +0100 From: Tormod Volden 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 --- 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);