From: Greg KH <greg@kroah.com>
To: Josh Boyer <jdub@us.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-usb-devel@lists.sourceforge.net
Subject: Re: [RFC PATCH] convert uhci-hcd to use debugfs
Date: Fri, 10 Dec 2004 07:27:28 -0800 [thread overview]
Message-ID: <20041210152728.GA5827@kroah.com> (raw)
In-Reply-To: <1102688117.26320.7.camel@weaponx.rchland.ibm.com>
On Fri, Dec 10, 2004 at 08:15:18AM -0600, Josh Boyer wrote:
> On Thu, 2004-12-09 at 18:55, Greg KH wrote:
> > static int uhci_proc_open(struct inode *inode, struct file *file)
> > {
>
> Didn't want to rename this uhci_debug_open?
Yeah, I could :)
> > -#ifdef CONFIG_PROC_FS
> > - ent = create_proc_entry(hcd->self.bus_name, S_IFREG|S_IRUGO|S_IWUSR, uhci_proc_root);
> > - if (!ent) {
> > - dev_err(uhci_dev(uhci), "couldn't create uhci proc entry\n");
> > + dentry = debugfs_create_file(hcd->self.bus_name, S_IFREG|S_IRUGO|S_IWUSR, uhci_debugfs_root, uhci, &uhci_proc_operations);
> > + if (!dentry) {
>
> That won't work if debugfs is not configured. You'll get back (void *)
> -ENODEV, which is not NULL.
That's exactly correct. We do _not_ want NULL to be returned if debugfs
is not configured in. We want to be able to detect if an error
happened, not if the feature was just not configured. Otherwise, if we
did return NULL if debugfs was not enabled, this code would just fail
and the uhci startup would never happen.
This is why people have to wrap proc functions in #ifdef, and why no one
ever checks the return values from devfs calls. It's a real problem and
I don't want to duplicate that again.
thanks,
greg k-h
next prev parent reply other threads:[~2004-12-10 15:33 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-10 0:50 [RFC PATCH] debugfs - yet another in-kernel file system Greg KH
2004-12-10 0:55 ` [RFC PATCH] convert uhci-hcd to use debugfs Greg KH
2004-12-10 14:15 ` Josh Boyer
2004-12-10 15:27 ` Greg KH [this message]
2004-12-10 16:21 ` Josh Boyer
2004-12-10 17:17 ` Comments on new kernel dev. model Peter Karlsson
2004-12-10 23:44 ` Greg KH
2004-12-10 7:07 ` [RFC PATCH] debugfs - yet another in-kernel file system Jan Engelhardt
2004-12-10 7:54 ` Greg KH
2004-12-10 8:00 ` Jan Engelhardt
2004-12-10 16:02 ` Greg KH
2004-12-10 14:46 ` Josh Boyer
2004-12-10 15:30 ` Greg KH
2004-12-10 16:26 ` Josh Boyer
2004-12-10 17:21 ` Jörn Engel
2004-12-10 17:35 ` Greg KH
2004-12-10 18:29 ` Jörn Engel
2004-12-10 19:38 ` Roland Dreier
2004-12-11 1:29 ` [linux-usb-devel] " David Brownell
2004-12-11 1:39 ` Greg KH
2004-12-11 2:02 ` David Brownell
2004-12-11 2:05 ` Greg KH
2004-12-11 2:26 ` Roland Dreier
2004-12-11 2:32 ` Greg KH
2004-12-11 13:23 ` Roland Dreier
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=20041210152728.GA5827@kroah.com \
--to=greg@kroah.com \
--cc=jdub@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
/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