oprofilefs: don't oops on allocation failure
[linux-2.6-block.git] / drivers / oprofile / oprofilefs.c
index d77ebbfc67c98f8b63cdde527b8a59d7135486bd..4ea08979312ca3e86804d5c7fa3e49be5969606a 100644 (file)
@@ -138,6 +138,9 @@ static int __oprofilefs_create_file(struct dentry *root, char const *name,
        struct dentry *dentry;
        struct inode *inode;
 
+       if (!root)
+               return -ENOMEM;
+
        inode_lock(d_inode(root));
        dentry = d_alloc_name(root, name);
        if (!dentry) {