@@ -503,7 +503,7 @@ static noinline int create_subvol(struct mnt_idmap *idmap,
503503 struct btrfs_fs_info * fs_info = inode_to_fs_info (dir );
504504 struct btrfs_trans_handle * trans ;
505505 struct btrfs_key key ;
506- struct btrfs_root_item * root_item ;
506+ struct btrfs_root_item AUTO_KFREE ( root_item ) ;
507507 struct btrfs_inode_item * inode_item ;
508508 struct extent_buffer * leaf ;
509509 struct btrfs_root * root = BTRFS_I (dir )-> root ;
@@ -527,20 +527,18 @@ static noinline int create_subvol(struct mnt_idmap *idmap,
527527
528528 ret = btrfs_get_free_objectid (fs_info -> tree_root , & objectid );
529529 if (ret )
530- goto out_root_item ;
530+ return ret ;
531531
532532 /*
533533 * Don't create subvolume whose level is not zero. Or qgroup will be
534534 * screwed up since it assumes subvolume qgroup's level to be 0.
535535 */
536- if (btrfs_qgroup_level (objectid )) {
537- ret = - ENOSPC ;
538- goto out_root_item ;
539- }
536+ if (btrfs_qgroup_level (objectid ))
537+ return - ENOSPC ;
540538
541539 ret = get_anon_bdev (& anon_dev );
542540 if (ret < 0 )
543- goto out_root_item ;
541+ return ret ;
544542
545543 new_inode_args .inode = btrfs_new_subvol_inode (idmap , dir );
546544 if (!new_inode_args .inode ) {
@@ -692,8 +690,7 @@ static noinline int create_subvol(struct mnt_idmap *idmap,
692690out_anon_dev :
693691 if (anon_dev )
694692 free_anon_bdev (anon_dev );
695- out_root_item :
696- kfree (root_item );
693+
697694 return ret ;
698695}
699696
@@ -2956,7 +2953,7 @@ static long btrfs_ioctl_space_info(struct btrfs_fs_info *fs_info,
29562953 struct btrfs_ioctl_space_args space_args = { 0 };
29572954 struct btrfs_ioctl_space_info space ;
29582955 struct btrfs_ioctl_space_info * dest ;
2959- struct btrfs_ioctl_space_info * dest_orig ;
2956+ struct btrfs_ioctl_space_info AUTO_KFREE ( dest_orig ) ;
29602957 struct btrfs_ioctl_space_info __user * user_dest ;
29612958 struct btrfs_space_info * info ;
29622959 static const u64 types [] = {
@@ -3077,9 +3074,8 @@ static long btrfs_ioctl_space_info(struct btrfs_fs_info *fs_info,
30773074 (arg + sizeof (struct btrfs_ioctl_space_args ));
30783075
30793076 if (copy_to_user (user_dest , dest_orig , alloc_size ))
3080- ret = - EFAULT ;
3077+ return - EFAULT ;
30813078
3082- kfree (dest_orig );
30833079out :
30843080 if (ret == 0 && copy_to_user (arg , & space_args , sizeof (space_args )))
30853081 ret = - EFAULT ;
@@ -3610,7 +3606,7 @@ static long btrfs_ioctl_balance_ctl(struct btrfs_fs_info *fs_info, int cmd)
36103606static long btrfs_ioctl_balance_progress (struct btrfs_fs_info * fs_info ,
36113607 void __user * arg )
36123608{
3613- struct btrfs_ioctl_balance_args * bargs ;
3609+ struct btrfs_ioctl_balance_args AUTO_KFREE ( bargs ) ;
36143610 int ret = 0 ;
36153611
36163612 if (!capable (CAP_SYS_ADMIN ))
@@ -3632,8 +3628,6 @@ static long btrfs_ioctl_balance_progress(struct btrfs_fs_info *fs_info,
36323628
36333629 if (copy_to_user (arg , bargs , sizeof (* bargs )))
36343630 ret = - EFAULT ;
3635-
3636- kfree (bargs );
36373631out :
36383632 mutex_unlock (& fs_info -> balance_mutex );
36393633 return ret ;
@@ -4227,20 +4221,19 @@ static int check_feature_bits(const struct btrfs_fs_info *fs_info,
42274221 u64 safe_set , u64 safe_clear )
42284222{
42294223 const char * type = btrfs_feature_set_name (set );
4230- char * names ;
4224+ const char AUTO_KFREE ( names ) ;
42314225 u64 disallowed , unsupported ;
42324226 u64 set_mask = flags & change_mask ;
42334227 u64 clear_mask = ~flags & change_mask ;
42344228
42354229 unsupported = set_mask & ~supported_flags ;
42364230 if (unsupported ) {
42374231 names = btrfs_printable_features (set , unsupported );
4238- if (names ) {
4232+ if (names )
42394233 btrfs_warn (fs_info ,
42404234 "this kernel does not support the %s feature bit%s" ,
42414235 names , strchr (names , ',' ) ? "s" : "" );
4242- kfree (names );
4243- } else
4236+ else
42444237 btrfs_warn (fs_info ,
42454238 "this kernel does not support %s bits 0x%llx" ,
42464239 type , unsupported );
@@ -4250,12 +4243,11 @@ static int check_feature_bits(const struct btrfs_fs_info *fs_info,
42504243 disallowed = set_mask & ~safe_set ;
42514244 if (disallowed ) {
42524245 names = btrfs_printable_features (set , disallowed );
4253- if (names ) {
4246+ if (names )
42544247 btrfs_warn (fs_info ,
42554248 "can't set the %s feature bit%s while mounted" ,
42564249 names , strchr (names , ',' ) ? "s" : "" );
4257- kfree (names );
4258- } else
4250+ else
42594251 btrfs_warn (fs_info ,
42604252 "can't set %s bits 0x%llx while mounted" ,
42614253 type , disallowed );
@@ -4265,12 +4257,11 @@ static int check_feature_bits(const struct btrfs_fs_info *fs_info,
42654257 disallowed = clear_mask & ~safe_clear ;
42664258 if (disallowed ) {
42674259 names = btrfs_printable_features (set , disallowed );
4268- if (names ) {
4260+ if (names )
42694261 btrfs_warn (fs_info ,
42704262 "can't clear the %s feature bit%s while mounted" ,
42714263 names , strchr (names , ',' ) ? "s" : "" );
4272- kfree (names );
4273- } else
4264+ else
42744265 btrfs_warn (fs_info ,
42754266 "can't clear %s bits 0x%llx while mounted" ,
42764267 type , disallowed );
0 commit comments