static DEFINE_MUTEX(pstore_sb_lock);
static struct super_block *pstore_sb;
+DEFINE_FREE(pstore_iput, struct inode *, if (_T) iput(_T))
+
struct pstore_private {
struct list_head list;
struct dentry *dentry;
int pstore_mkfile(struct dentry *root, struct pstore_record *record)
{
struct dentry *dentry;
- struct inode *inode;
+ struct inode *inode __free(pstore_iput) = NULL;
int rc = 0;
char name[PSTORE_NAMELEN];
struct pstore_private *private, *pos;
private = kzalloc(sizeof(*private), GFP_KERNEL);
if (!private)
- goto fail_inode;
+ return -ENOMEM;
dentry = d_alloc_name(root, name);
if (!dentry)
inode_set_mtime_to_ts(inode,
inode_set_ctime_to_ts(inode, record->time));
- d_add(dentry, inode);
+ d_add(dentry, no_free_ptr(inode));
list_add(&private->list, &records_list);
fail_private:
free_pstore_private(private);
-fail_inode:
- iput(inode);
return rc;
}