Re: [PATCH] pstore/ftrace: Convert to its own enable/disable debugfsknob
From: Anton Vorontsov
Date: Wed Jul 18 2012 - 14:52:39 EST
On Wed, Jul 18, 2012 at 10:12:44AM -0700, Stephen Boyd wrote:
> On 07/17/12 20:47, Anton Vorontsov wrote:
> > +
> > + file = debugfs_create_file("record_ftrace", 0600, dir, NULL,
> > + &pstore_knob_fops);
> > + if (IS_ERR_OR_NULL(file)) {
> > + err = PTR_ERR(file);
> > + pr_err("%s: unable to create pstore/ftrace file: %d\n",
> > + __func__, err);
> > + goto err_file;
> > + }
>
> debugfs only returns NULL on failure.
Well, techincally, with DEBUG_FS=y, yes. (And we have dependency on
it.)
But see include/linux/debugfs.h for DEBUG_FS=n case:
static inline struct dentry *debugfs_create_file(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *fops)
{
return ERR_PTR(-ENODEV);
}
So, I think it is fine to check for IS_ERR_OR_NULL(), although today
it's always NULL for our case, true.
Thanks,
--
Anton Vorontsov
Email: cbouatmailru@xxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/