File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change 16
16
#include <linux/fs.h>
17
17
#include <linux/nd.h>
18
18
#include <linux/backing-dev.h>
19
+ #include <linux/cleanup.h>
19
20
#include "btt.h"
20
21
#include "nd.h"
21
22
@@ -847,23 +848,20 @@ static int discover_arenas(struct btt *btt)
847
848
{
848
849
int ret = 0 ;
849
850
struct arena_info * arena ;
850
- struct btt_sb * super ;
851
851
size_t remaining = btt -> rawsize ;
852
852
u64 cur_nlba = 0 ;
853
853
size_t cur_off = 0 ;
854
854
int num_arenas = 0 ;
855
855
856
- super = kzalloc (sizeof (* super ), GFP_KERNEL );
856
+ struct btt_sb * super __free ( kfree ) = kzalloc (sizeof (* super ), GFP_KERNEL );
857
857
if (!super )
858
858
return - ENOMEM ;
859
859
860
860
while (remaining ) {
861
861
/* Alloc memory for arena */
862
862
arena = alloc_arena (btt , 0 , 0 , 0 );
863
- if (!arena ) {
864
- ret = - ENOMEM ;
865
- goto out_super ;
866
- }
863
+ if (!arena )
864
+ return - ENOMEM ;
867
865
868
866
arena -> infooff = cur_off ;
869
867
ret = btt_info_read (arena , super );
@@ -919,14 +917,11 @@ static int discover_arenas(struct btt *btt)
919
917
btt -> nlba = cur_nlba ;
920
918
btt -> init_state = INIT_READY ;
921
919
922
- kfree (super );
923
920
return ret ;
924
921
925
922
out :
926
923
kfree (arena );
927
924
free_arenas (btt );
928
- out_super :
929
- kfree (super );
930
925
return ret ;
931
926
}
932
927
You can’t perform that action at this time.
0 commit comments