From: Felipe Balbi <balbi@ti.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Bin Liu <binmlist@gmail.com>,
linux-usb@vger.kernel.org, Felipe Balbi <balbi@ti.com>,
kernel@pengutronix.de, Markus Pargmann <mpa@pengutronix.de>,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 1/2] usb: musb: dsps, debugfs files
Date: Tue, 18 Feb 2014 11:50:19 -0600 [thread overview]
Message-ID: <20140218175018.GF28506@saruman.home> (raw)
In-Reply-To: <20140218173021.GA17368@kroah.com>
[-- Attachment #1.1: Type: text/plain, Size: 1365 bytes --]
Hi,
On Tue, Feb 18, 2014 at 09:30:21AM -0800, Greg KH wrote:
> > > > > +static int dsps_musb_dbg_init(struct musb *musb, struct dsps_glue *glue)
> > > > > +{
> > > > > + struct dentry *root;
> > > > > + struct dentry *file;
> > > > > + char buf[128];
> > > > > +
> > > > > + sprintf(buf, "%s.dsps", dev_name(musb->controller));
> > > > > + root = debugfs_create_dir(buf, NULL);
> > > > > + if (!root)
> > > >
> > > > wrong, you should be using IS_ERR()
> > >
> > > !root is fine, IS_ERR() will fail if CONFIG_DEBUGFS is not enabled.
> >
> > in that case, files will be created on parent directory right ?
>
> If, for some reason, creating a directory fails and then creating a file
> would succeed, yes, that will happen.
>
> > If we pass a ERR_PTR(-ENODEV), otoh, we will try to dereference it in
> > __create_file().
>
> No, because -ENODEV will only happen if debugfs is not enabled, so no
> dereference will ever happen.
>
> Don't worry about checking return values from debugfs, it shouldn't be
> needed.
aha, now I see. I missed the:
348 if (error) {
349 dentry = NULL;
350 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
351 }
in fs/debugfs/inode.c::__create_file(). I'll apply this patch in a few
hours (randconfig running).
cheers
--
balbi
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2014-02-18 17:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-17 9:22 [PATCH v4 0/2] usb: musb dsps updates Markus Pargmann
[not found] ` <1389950556-6453-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-01-17 9:22 ` [PATCH v4 1/2] usb: musb: dsps, debugfs files Markus Pargmann
2014-02-18 16:20 ` Felipe Balbi
2014-02-18 16:59 ` Greg KH
2014-02-18 17:03 ` Felipe Balbi
2014-02-18 17:30 ` Greg KH
2014-02-18 17:50 ` Felipe Balbi [this message]
2014-02-16 22:03 ` [PATCH v4 0/2] usb: musb dsps updates Markus Pargmann
2014-01-17 9:22 ` [PATCH v4 2/2] usb: musb: dsps, use devm_kzalloc Markus Pargmann
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=20140218175018.GF28506@saruman.home \
--to=balbi@ti.com \
--cc=binmlist@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mpa@pengutronix.de \
/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).