On Sun, Apr 29, 2012 at 12:36 AM, Andrew Morton wrote: > On Sun, 29 Apr 2012 00:32:26 +0530 Sasikanth babu > wrote: > > > > Fact is, debugfs_create_dir() and debugfs_create_file() are stupid > > > interfaces which don't provide the caller (and hence the user) with any > > > information about why they failed. Perhaps memblock_init_debugfs() > > > should return -EWESUCK. > > > > > > > I'm working on a patch which address this issue. debugfs_create_XXX > > calls > > will return proper error codes, and fixing the existing code not each > > and every part but the code > > which handles the values returned by debufs_create_XXX otherwise it > will > > break the existing > > functionality . > > Excellent! > > > (any suggestions or opinions ?) > > Well, don't modify the existing interfaces: create new ones and we can > migrate gradually. But you're probably already doing that. > Not going to change the existing interface. Modified debugfs_create_XXX to return ERR_PTR(error) instead of NULL. [sasikantha@localhost linux-2.6]$ git diff diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index b80bc84..f5a5783 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -378,7 +378,7 @@ struct dentry *debugfs_create_file(const char *name, umode_t mode, error = debugfs_create_by_name(name, mode, parent, &dentry, data, fops); if (error) { - dentry = NULL; + dentry = ERR_PTR(error); simple_release_fs(&debugfs_mount, &debugfs_mount_count); goto exit; } And from the caller side modifying the code as shown below (Currently started doing modification for each subsystem) dir = debugfs_create_dir("test", NULL); if (IS_ERR(dir)) { return PTR_ERR(dir); } I think as you had mentioned creating new interface and migrating gradually is the right of way of doing it. Thanks Sasi