@@ -63,6 +63,7 @@ static void free_pstore_private(struct pstore_private *private)
63
63
}
64
64
kfree (private );
65
65
}
66
+ DEFINE_FREE (pstore_private , struct pstore_private * , free_pstore_private (_T ));
66
67
67
68
static void * pstore_ftrace_seq_start (struct seq_file * s , loff_t * pos )
68
69
{
@@ -340,9 +341,8 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)
340
341
{
341
342
struct dentry * dentry ;
342
343
struct inode * inode __free (pstore_iput ) = NULL ;
343
- int rc = 0 ;
344
344
char name [PSTORE_NAMELEN ];
345
- struct pstore_private * private , * pos ;
345
+ struct pstore_private * private __free ( pstore_private ) = NULL , * pos ;
346
346
size_t size = record -> size + record -> ecc_notice_size ;
347
347
348
348
if (WARN_ON (!inode_is_locked (d_inode (root ))))
@@ -358,7 +358,6 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)
358
358
return - EEXIST ;
359
359
}
360
360
361
- rc = - ENOMEM ;
362
361
inode = pstore_get_inode (root -> d_sb );
363
362
if (!inode )
364
363
return - ENOMEM ;
@@ -375,7 +374,7 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)
375
374
376
375
dentry = d_alloc_name (root , name );
377
376
if (!dentry )
378
- goto fail_private ;
377
+ return - ENOMEM ;
379
378
380
379
private -> dentry = dentry ;
381
380
private -> record = record ;
@@ -388,13 +387,9 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record)
388
387
389
388
d_add (dentry , no_free_ptr (inode ));
390
389
391
- list_add (& private -> list , & records_list );
390
+ list_add (& ( no_free_ptr ( private )) -> list , & records_list );
392
391
393
392
return 0 ;
394
-
395
- fail_private :
396
- free_pstore_private (private );
397
- return rc ;
398
393
}
399
394
400
395
/*
0 commit comments