[PATCH 1/2] mtd: nand: generalized error messages with __func__
Brian Norris
computersforpeace at gmail.com
Tue May 31 14:52:10 EDT 2011
Hi,
Sorry if this is a second message anyone, I didn't hit Reply-All.
On Wed, May 25, 2011 at 10:16 PM, Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> Right, but in this _particular_ case the best thing to do is to just
> kill the error messages - if any of the allocation functions fail they
> print a large scary warning with a backtrace anyway, and the backtrace
> will contain the caller function names.
>
> Brian, would you please instead just zap the prints?
Sure, can do. In general, then, is it best practice to simply 'return
-ENOMEM' or similar (without any printing) in all MTD code?
> On Thu, 2011-05-26 at 08:14 +0300, Igor Grinberg wrote:
>> On 05/26/11 00:59, Brian Norris wrote:
>> pr_err() will save you from the need to define the log level each time.
>> pr_fmt will save you the need to add %s: and __func__.
Also, it seems that the second statement is not necessarily true. In
fact, in include/linux/printk.h, we default to the following
declaration:
#define pr_fmt(fmt) fmt
So it seems that, when we desire to print out the relevant function
name, we should manually use __func__ instead of relying on
pr_fmt...or should we define our own pr_fmt in include/linux/mtd.h?
Brian
More information about the linux-mtd
mailing list