public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: print source of "uncorrectable error" message
@ 2013-01-11 23:43 Tormod Volden
  2013-01-12  9:01 ` Vikram Narayanan
  0 siblings, 1 reply; 6+ messages in thread
From: Tormod Volden @ 2013-01-11 23:43 UTC (permalink / raw)
  To: linux-mtd

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 : ");
 	return -1;
 }
 EXPORT_SYMBOL(__nand_correct_data);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mtd: nand: print source of "uncorrectable error" message
  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   ` [PATCH v2] mtd/nand: Print source of error message Tormod Volden
  0 siblings, 1 reply; 6+ messages in thread
From: Vikram Narayanan @ 2013-01-12  9:01 UTC (permalink / raw)
  To: Tormod Volden; +Cc: linux-mtd

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] mtd/nand: Print source of error message
  2013-01-12  9:01 ` Vikram Narayanan
@ 2013-01-12 10:34   ` Tormod Volden
  2013-01-17 13:56     ` Artem Bityutskiy
  0 siblings, 1 reply; 6+ messages in thread
From: Tormod Volden @ 2013-01-12 10:34 UTC (permalink / raw)
  To: linux-mtd; +Cc: Vikram Narayanan

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mtd/nand: Print source of error message
  2013-01-12 10:34   ` [PATCH v2] mtd/nand: Print source of error message Tormod Volden
@ 2013-01-17 13:56     ` Artem Bityutskiy
  2013-01-17 22:58       ` Tormod Volden
  0 siblings, 1 reply; 6+ messages in thread
From: Artem Bityutskiy @ 2013-01-17 13:56 UTC (permalink / raw)
  To: Tormod Volden; +Cc: Vikram Narayanan, linux-mtd

[-- Attachment #1: Type: text/plain, Size: 593 bytes --]

On Sat, 2013-01-12 at 11:34 +0100, 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>

Pushed to l2-mtd.git with a minor amendment (kill the semicolon at the
end).

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mtd/nand: Print source of error message
  2013-01-17 13:56     ` Artem Bityutskiy
@ 2013-01-17 22:58       ` Tormod Volden
  2013-01-18 10:18         ` Artem Bityutskiy
  0 siblings, 1 reply; 6+ messages in thread
From: Tormod Volden @ 2013-01-17 22:58 UTC (permalink / raw)
  To: dedekind1; +Cc: Vikram Narayanan, linux-mtd

On Thu, Jan 17, 2013 at 2:56 PM, Artem Bityutskiy wrote:
> On Sat, 2013-01-12 at 11:34 +0100, 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>
>
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mtd/nand: Print source of error message
  2013-01-17 22:58       ` Tormod Volden
@ 2013-01-18 10:18         ` Artem Bityutskiy
  0 siblings, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2013-01-18 10:18 UTC (permalink / raw)
  To: Tormod Volden; +Cc: Vikram Narayanan, linux-mtd

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]

On Thu, 2013-01-17 at 23:58 +0100, Tormod Volden wrote:
> 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.

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-18 10:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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   ` [PATCH v2] mtd/nand: Print source of error message Tormod Volden
2013-01-17 13:56     ` Artem Bityutskiy
2013-01-17 22:58       ` Tormod Volden
2013-01-18 10:18         ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox