The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org, Ben Hutchings <ben@decadent.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings
Date: Wed, 10 Jul 2013 14:28:25 +0200	[thread overview]
Message-ID: <1373459305.4399.27.camel@chaos.site> (raw)
In-Reply-To: <1373386794.14604.14.camel@joe-AO722>

Hi Joe,

Le Tuesday 09 July 2013 à 09:19 -0700, Joe Perches a écrit :
> On Tue, 2013-07-09 at 17:42 +0200, Jean Delvare wrote:
> > Fix all errors and trivial warnings reported by checkpatch for file
> > drivers/firmware/dmi_scan.c.
> 
> trivia:
> 
> > +++ linux-3.11-rc0/drivers/firmware/dmi_scan.c	2013-07-09 16:08:13.979592957 +0200
> > @@ -63,7 +63,7 @@ static char * __init dmi_string(const st
> >  	if (str != NULL)
> >  		strcpy(str, bp);
> >  	else
> > -		printk(KERN_ERR "dmi_string: cannot allocate %Zu bytes.\n", len);
> > +		pr_err("dmi_string: cannot allocate %Zu bytes.\n", len);
> 
> If the function name is used in every printk, it might
> be better to add
> 
> #define pr_fmt(fmt) "%s: " fmt, __func__
> 
> before any #include

No, only error messages include the function name, debug and info
messages do not.

> If not, then I suggest removing the embedded function names
> and writing these as
> 		pr_err("%s: etc...", __func__, etc...);
> 
> This eliminates any possible function name mismatch.

I had considered this too, but stepped back after finding out that this
change would increase the binary size. It's hard to sell such a change
then when it's only fixing a theoretical problem.

> > @@ -217,7 +220,7 @@ static void __init dmi_save_one_device(i
> >  
> >  	dev = dmi_alloc(sizeof(*dev) + strlen(name) + 1);
> >  	if (!dev) {
> > -		printk(KERN_ERR "dmi_save_one_device: out of memory.\n");
> > +		pr_err("dmi_save_one_device: out of memory.\n");
> 
> OOM messages generally aren't useful.
> 
> dmi_alloc is either a trivial front-end to kmalloc,
> and kmalloc already does a dump_stack() when OOM, or
> for x86, dmi_alloc uses extend_brk which BUGs when
> unsuccessful.

Fair enough, I'll send a separate patch for this in a minute.

-- 
Jean Delvare
Suse L3


  parent reply	other threads:[~2013-07-10 12:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-09 15:40 [PATCH 0/3] firmware/dmi_scan: Cleanups Jean Delvare
2013-07-09 15:41 ` [PATCH 1/3] firmware/dmi_scan: Drop obsolete comment Jean Delvare
2013-07-09 15:42 ` [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings Jean Delvare
2013-07-09 16:19   ` Joe Perches
2013-07-09 17:13     ` ia64: dmi.h: Make dmi_alloc use kzalloc Joe Perches
2013-07-09 20:43       ` Tony Luck
2013-07-10 12:28     ` Jean Delvare [this message]
2013-07-10 14:59       ` [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings Joe Perches
2013-07-09 15:43 ` [PATCH 3/3] firmware/dmi_scan: Constify strings Jean Delvare
2013-07-09 15:58   ` Joe Perches
2013-07-09 16:23     ` Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373459305.4399.27.camel@chaos.site \
    --to=jdelvare@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=ben@decadent.org.uk \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox