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
signature.asc
Description: Digital signature
