mtd: nand: print source of "uncorrectable error" message
Subsystems (2)
PATCH 1/1 mtd: nand: print source of "uncorrectable error" message
From: Tormod Volden <[email protected]>
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 :
---
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(-)
drivers/mtd/nand/nand_ecc.c +1 -1
@@ -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);
Signature · 1 line
1.7.9.5
Quoted 33 lines · Tormod Volden
From: Tormod Volden <[email protected]>
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 <[email protected]>---
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,
Tormoddrivers/mtd/nand/nand_ecc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mtd/nand/nand_ecc.c +0
-0
drivers/mtd/nand/nand_ecc.c int __nand_correct_data(unsigned char *buf, · line 510
Quoted 5 lines
drivers/mtd/nand/nand_ecc.c +1
-1@@ -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 v2 1/1 mtd/nand: Print source of error message
From: Tormod Volden <[email protected]>
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 :
---
Quoted 3 lines · Vikram Narayanan
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(-)
drivers/mtd/nand/nand_ecc.c +2 -3
@@ -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);
Signature · 1 line
1.7.9.5
Artem Bityutskiy
AppliedRe: [PATCH v2] mtd/nand: Print source of error message
Quoted 6 lines · Tormod Volden
From: Tormod Volden <[email protected]>
Add the function name to the error message.
These messages are not very helpful:
Quoted 7 lines
[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 <[email protected]>
Pushed to l2-mtd.git with a minor amendment (kill the semicolon at the end).
Signature · 2 lines
Best Regards, Artem Bityutskiy
Re: [PATCH v2] mtd/nand: Print source of error message
Quoted 13 lines · Artem Bityutskiy
Quoted 12 lines · Tormod Volden
From: Tormod Volden <[email protected]>
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 :
Quoted 4 lines
Quoted 1 line
Signed-off-by Tormod Volden <[email protected]>Pushed to l2-mtd.git with a minor amendment (kill the semicolon at the end).
Thanks! I guess the intention of the colon at the end was that the calling function would fill in more details, but if this does not happen it is better without. In that case it should even be a \n at the end though...
Tormod
Re: [PATCH v2] mtd/nand: Print source of error message
Quoted 4 lines · Tormod Volden
Thanks! I guess the intention of the colon at the end was that the calling function would fill in more details, but if this does not happen it is better without. In that case it should even be a \n at the end though...
Just added the "\n" character.
Signature · 2 lines
Best Regards, Artem Bityutskiy