virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Amit Shah <amit.shah@redhat.com>,
	kernel-janitors@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	virtualization@lists.linux-foundation.org
Subject: Re: [patch v2] virtio: console: cleanup an error message
Date: Mon, 29 Jul 2013 16:35:38 +0300	[thread overview]
Message-ID: <20130729133538.GG5053@mwanda> (raw)
In-Reply-To: <20130729131231.GC3779@kroah.com>

On Mon, Jul 29, 2013 at 06:12:31AM -0700, Greg Kroah-Hartman wrote:
> On Mon, Jul 29, 2013 at 12:41:31PM +0530, Amit Shah wrote:
> > On (Mon) 22 Jul 2013 [23:41:00], Dan Carpenter wrote:
> > > The PTR_ERR(NULL) here is not useful.
> > > 
> > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > ---
> > > v2: completely different
> > > 
> > > diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
> > > index 1b456fe..4cf46d8 100644
> > > --- a/drivers/char/virtio_console.c
> > > +++ b/drivers/char/virtio_console.c
> > > @@ -2215,10 +2215,8 @@ static int __init init(void)
> > >  	}
> > >  
> > >  	pdrvdata.debugfs_dir = debugfs_create_dir("virtio-ports", NULL);
> > > -	if (!pdrvdata.debugfs_dir) {
> > > -		pr_warning("Error %ld creating debugfs dir for virtio-ports\n",
> > > -			   PTR_ERR(pdrvdata.debugfs_dir));
> > > -	}
> > > +	if (!pdrvdata.debugfs_dir)
> > > +		pr_warning("Error creating debugfs dir for virtio-ports\n");
> > 
> > When debugfs is enabled and creating the dir fails, we'll print this
> > warning message.
> > 
> > When debugfs is disabled, we'll get an error return, and not print any
> > message.
> 
> Not true, you will still print the message if debugfs is disabled, as
> .debugfs_dir will not be NULL.
> 
> Why even print anything at all?  It's debugfs, you shouldn't really care
> that much about it :)
>

Yes yes.  That's what this code does.  It only checks for NULL.  The
debugfs was a little confusing at first but I get it now.

regards,
dan carpenter

  parent reply	other threads:[~2013-07-29 13:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19  5:50 [patch] virtio: console: fix error handling for debugfs_create_dir() Dan Carpenter
2013-07-19  6:13 ` Amit Shah
2013-07-19 10:28 ` Arnd Bergmann
     [not found] ` <201307191228.41794.arnd@arndb.de>
2013-07-20 21:50   ` Dan Carpenter
2013-07-21  9:36     ` Arnd Bergmann
     [not found]     ` <201307211136.25989.arnd@arndb.de>
2013-07-21 15:49       ` Greg Kroah-Hartman
2013-07-21 22:33       ` Dan Carpenter
2013-07-22 20:41   ` [patch v2] virtio: console: cleanup an error message Dan Carpenter
2013-07-23  4:35     ` Greg Kroah-Hartman
2013-07-29  7:11     ` Amit Shah
2013-07-29 13:12       ` Greg Kroah-Hartman
     [not found]       ` <20130729131231.GC3779@kroah.com>
2013-07-29 13:35         ` Dan Carpenter [this message]
2013-07-29 13:44           ` Greg Kroah-Hartman
2013-07-30  6:23     ` Rusty Russell

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=20130729133538.GG5053@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=amit.shah@redhat.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.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;
as well as URLs for NNTP newsgroup(s).