LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Zhaolei <zhaolei@cn.fujitsu.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
linux-kernel@vger.kernel.org, dbrownell@users.sourceforge.net,
linux-usb@vger.kernel.org
Subject: Re: [PATCH] Fix debugfs_create_file's error checking method for usb/gadget/
Date: Sun, 19 Oct 2008 20:46:39 -0700 [thread overview]
Message-ID: <20081020034639.GB26650@kroah.com> (raw)
In-Reply-To: <4F580DA88E8146FC8BDA0789613AB813@zhaoleiwin>
On Mon, Oct 20, 2008 at 09:15:16AM +0800, Zhaolei wrote:
> From: "Alan Stern" <stern@rowland.harvard.edu>
> To: "Zhaolei" <zhaolei@cn.fujitsu.com>
> Cc: <linux-kernel@vger.kernel.org>; <dbrownell@users.sourceforge.net>; <linux-usb@vger.kernel.org>
> Sent: Friday, October 17, 2008 11:18 PM
> Subject: Re: [PATCH] Fix debugfs_create_file's error checking method for usb/gadget/
>
>
> > On Fri, 17 Oct 2008, Zhaolei wrote:
> >
> >> Hi,
> >>
> >> debugfs_create_file() returns NULL if an error occurs, returns -ENODEV
> >> when debugfs is not enabled in the kernel.
> >>
> >> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
> >> ---
> >> drivers/usb/gadget/s3c2410_udc.c | 2 +-
> >> 1 files changed, 1 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
> >> index 29d13eb..4ba50ef 100644
> >> --- a/drivers/usb/gadget/s3c2410_udc.c
> >> +++ b/drivers/usb/gadget/s3c2410_udc.c
> >> @@ -1894,7 +1894,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
> >> udc->regs_info = debugfs_create_file("registers", S_IRUGO,
> >> s3c2410_udc_debugfs_root,
> >> udc, &s3c2410_udc_debugfs_fops);
> >> - if (IS_ERR(udc->regs_info)) {
> >> + if (IS_ERR(udc->regs_info) || !udc->regs_info) {
> >> dev_warn(dev, "debugfs file creation failed %ld\n",
> >> PTR_ERR(udc->regs_info));
> >> udc->regs_info = NULL;
> >
> > In fact the original code and your patch are both wrong. The test
> > should simply be:
> >
> > if (!udc->regs_info) {
> > dev_warn(dev, "debugfs file creation failed\n");
> >
> Hello, Alan Stern
>
> If we only check if (!udc->regs_info), that is no problem except that we
> can't see dev_warn when debugfs isn't enabled in the kernel.
> It this warning message is not necessary, I agree with you.
Why would you want to see that message if debugfs wasn't selected? You
shouldn't need to see it, that is why the debugfs code doesn't return
NULL if it is compiled out. I did it that way to make all callers much
simpler :)
thanks,
greg k-h
next prev parent reply other threads:[~2008-10-20 3:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-17 12:54 [PATCH] Fix debugfs_create_file's error checking method for usb/gadget/ Zhaolei
2008-10-17 15:18 ` Alan Stern
2008-10-20 1:15 ` Zhaolei
2008-10-20 1:19 ` Zhaolei
2008-10-20 3:46 ` Greg KH [this message]
2008-10-20 10:53 ` [PATCH v2] " Zhaolei
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=20081020034639.GB26650@kroah.com \
--to=greg@kroah.com \
--cc=dbrownell@users.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=zhaolei@cn.fujitsu.com \
/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).