Re: [PATCH 1/5] ovl: remove unneeded goto instructions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2023-04-12 at 16:54 +0300, Amir Goldstein wrote:
> There is nothing in the out goto target of ovl_get_layers().
> 
> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>

LGTM

Reviewed-by: Alexander Larsson <alexl@xxxxxxxxxx>

> ---
>  fs/overlayfs/super.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> index 6e4231799b86..7742aef3f3b3 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -1586,10 +1586,9 @@ static int ovl_get_layers(struct super_block
> *sb, struct ovl_fs *ofs,
>         int err;
>         unsigned int i;
>  
> -       err = -ENOMEM;
>         ofs->fs = kcalloc(numlower + 1, sizeof(struct ovl_sb),
> GFP_KERNEL);
>         if (ofs->fs == NULL)
> -               goto out;
> +               return -ENOMEM;
>  
>         /* idx/fsid 0 are reserved for upper fs even with lower only
> overlay */
>         ofs->numfs++;
> @@ -1603,7 +1602,7 @@ static int ovl_get_layers(struct super_block
> *sb, struct ovl_fs *ofs,
>         err = get_anon_bdev(&ofs->fs[0].pseudo_dev);
>         if (err) {
>                 pr_err("failed to get anonymous bdev for upper
> fs\n");
> -               goto out;
> +               return err;
>         }
>  
>         if (ovl_upper_mnt(ofs)) {
> @@ -1616,9 +1615,9 @@ static int ovl_get_layers(struct super_block
> *sb, struct ovl_fs *ofs,
>                 struct inode *trap;
>                 int fsid;
>  
> -               err = fsid = ovl_get_fsid(ofs, &stack[i]);
> -               if (err < 0)
> -                       goto out;
> +               fsid = ovl_get_fsid(ofs, &stack[i]);
> +               if (fsid < 0)
> +                       return fsid;
>  
>                 /*
>                  * Check if lower root conflicts with this overlay
> layers before
> @@ -1629,13 +1628,13 @@ static int ovl_get_layers(struct super_block
> *sb, struct ovl_fs *ofs,
>                  */
>                 err = ovl_setup_trap(sb, stack[i].dentry, &trap,
> "lowerdir");
>                 if (err)
> -                       goto out;
> +                       return err;
>  
>                 if (ovl_is_inuse(stack[i].dentry)) {
>                         err = ovl_report_in_use(ofs, "lowerdir");
>                         if (err) {
>                                 iput(trap);
> -                               goto out;
> +                               return err;
>                         }
>                 }
>  
> @@ -1644,7 +1643,7 @@ static int ovl_get_layers(struct super_block
> *sb, struct ovl_fs *ofs,
>                 if (IS_ERR(mnt)) {
>                         pr_err("failed to clone lowerpath\n");
>                         iput(trap);
> -                       goto out;
> +                       return err;
>                 }
>  
>                 /*
> @@ -1694,9 +1693,7 @@ static int ovl_get_layers(struct super_block
> *sb, struct ovl_fs *ofs,
>                         ofs->xino_mode);
>         }
>  
> -       err = 0;
> -out:
> -       return err;
> +       return 0;
>  }
>  
>  static int ovl_get_lowerstack(struct super_block *sb, struct
> ovl_entry *oe,

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=
 Alexander Larsson                                            Red Hat,
Inc 
       alexl@xxxxxxxxxx            alexander.larsson@xxxxxxxxx 
He's a maverick shark-wrestling romance novelist in a wheelchair. She's
a 
manipulative nymphomaniac Hell's Angel with a birthmark shaped like 
Liberty's torch. They fight crime! 




[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux