Patchwork mtd: nand: print source of "uncorrectable error" message

login
register
mail settings
Submitter Tormod Volden
Date Jan. 11, 2013, 11:43 p.m.
Message ID <1357947835-20194-1-git-send-email-lists.tormod@gmail.com>
Download mbox | patch
Permalink /patch/211457/
State New
Headers show

Comments

Tormod Volden - Jan. 11, 2013, 11:43 p.m.
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>
---

Not sure if above messages come from this code. I also believe there must be
a better way, advice welcome. Maybe we need to make sure all possible callers
print additional information if -1 is returned.

But this small change should be better than nothing, meanwhile.

Regards,
Tormod


 drivers/mtd/nand/nand_ecc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Vikram Narayanan - Jan. 12, 2013, 9:01 a.m.
On 1/12/2013 5:13 AM, Tormod Volden wrote:
> 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>
> ---
>
> Not sure if above messages come from this code. I also believe there must be
> a better way, advice welcome. Maybe we need to make sure all possible callers
> print additional information if -1 is returned.
>
> But this small change should be better than nothing, meanwhile.
>
> Regards,
> Tormod
>
>
>   drivers/mtd/nand/nand_ecc.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/nand_ecc.c b/drivers/mtd/nand/nand_ecc.c
> index b7cfe0d..cee06e9 100644
> --- a/drivers/mtd/nand/nand_ecc.c
> +++ b/drivers/mtd/nand/nand_ecc.c
> @@ -507,7 +507,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 : ");
> +	printk(KERN_ERR "__nand_correct_data: uncorrectable error : ");

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

Regards,
Vikram

Patch

diff --git a/drivers/mtd/nand/nand_ecc.c b/drivers/mtd/nand/nand_ecc.c
index b7cfe0d..cee06e9 100644
--- a/drivers/mtd/nand/nand_ecc.c
+++ b/drivers/mtd/nand/nand_ecc.c
@@ -507,7 +507,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 : ");
+	printk(KERN_ERR "__nand_correct_data: uncorrectable error : ");
 	return -1;
 }
 EXPORT_SYMBOL(__nand_correct_data);