diff mbox series

[v1,45/59] 9pfs/9p.c: remove unneeded labels

Message ID 20200106182425.20312-46-danielhb413@gmail.com
State New
Headers show
Series trivial unneeded labels cleanup | expand

Commit Message

Daniel Henrique Barboza Jan. 6, 2020, 6:24 p.m. UTC
'out' label in v9fs_xattr_write() and 'out_nofid' label in
v9fs_complete_rename() can be replaced by appropriate return
calls.

CC: Greg Kurz <groug@kaod.org>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 hw/9pfs/9p.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Christian Schoenebeck Jan. 7, 2020, 12:14 p.m. UTC | #1
On Montag, 6. Januar 2020 19:24:11 CET Daniel Henrique Barboza wrote:
> 'out' label in v9fs_xattr_write() and 'out_nofid' label in
> v9fs_complete_rename() can be replaced by appropriate return
> calls.
> 
> CC: Greg Kurz <groug@kaod.org>
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> ---
>  hw/9pfs/9p.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
> index 520177f40c..be2beba4cd 100644
> --- a/hw/9pfs/9p.c
> +++ b/hw/9pfs/9p.c
> @@ -2464,8 +2464,7 @@ static int v9fs_xattr_write(V9fsState *s, V9fsPDU
> *pdu, V9fsFidState *fidp,
> 
> 
>      if (fidp->fs.xattr.len < off) {
> -        err = -ENOSPC;
> -        goto out;
> +        return -ENOSPC;
>      }
>      write_count = fidp->fs.xattr.len - off;
>      if (write_count > count) {
> @@ -2491,7 +2490,7 @@ static int v9fs_xattr_write(V9fsState *s, V9fsPDU
> *pdu, V9fsFidState *fidp, off += to_copy;
>          write_count -= to_copy;
>      }
> -out:
> +
>      return err;
>  }
> 
> @@ -3056,8 +3055,7 @@ static int coroutine_fn v9fs_complete_rename(V9fsPDU
> *pdu, V9fsFidState *fidp, if (newdirfid != -1) {
>          dirfidp = get_fid(pdu, newdirfid);
>          if (dirfidp == NULL) {
> -            err = -ENOENT;
> -            goto out_nofid;
> +            return -ENOENT;
>          }
>          if (fidp->fid_type != P9_FID_NONE) {
>              err = -EINVAL;
> @@ -3100,7 +3098,6 @@ out:
>          put_fid(pdu, dirfidp);
>      }
>      v9fs_path_free(&new_path);
> -out_nofid:
>      return err;
>  }

Same as with patch 44: IMO not any improvement, but also not any behaviour 
change at least. So it's up to you Greg.

Best regards,
Christian Schoenebeck
Greg Kurz Jan. 8, 2020, 2:08 p.m. UTC | #2
On Tue, 07 Jan 2020 13:14:20 +0100
Christian Schoenebeck <qemu_oss@crudebyte.com> wrote:

> On Montag, 6. Januar 2020 19:24:11 CET Daniel Henrique Barboza wrote:
> > 'out' label in v9fs_xattr_write() and 'out_nofid' label in
> > v9fs_complete_rename() can be replaced by appropriate return
> > calls.
> > 
> > CC: Greg Kurz <groug@kaod.org>
> > Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> > ---
> >  hw/9pfs/9p.c | 9 +++------
> >  1 file changed, 3 insertions(+), 6 deletions(-)
> > 
> > diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
> > index 520177f40c..be2beba4cd 100644
> > --- a/hw/9pfs/9p.c
> > +++ b/hw/9pfs/9p.c
> > @@ -2464,8 +2464,7 @@ static int v9fs_xattr_write(V9fsState *s, V9fsPDU
> > *pdu, V9fsFidState *fidp,
> > 
> > 
> >      if (fidp->fs.xattr.len < off) {
> > -        err = -ENOSPC;
> > -        goto out;
> > +        return -ENOSPC;
> >      }
> >      write_count = fidp->fs.xattr.len - off;
> >      if (write_count > count) {
> > @@ -2491,7 +2490,7 @@ static int v9fs_xattr_write(V9fsState *s, V9fsPDU
> > *pdu, V9fsFidState *fidp, off += to_copy;
> >          write_count -= to_copy;
> >      }
> > -out:
> > +
> >      return err;
> >  }
> > 
> > @@ -3056,8 +3055,7 @@ static int coroutine_fn v9fs_complete_rename(V9fsPDU
> > *pdu, V9fsFidState *fidp, if (newdirfid != -1) {
> >          dirfidp = get_fid(pdu, newdirfid);
> >          if (dirfidp == NULL) {
> > -            err = -ENOENT;
> > -            goto out_nofid;
> > +            return -ENOENT;
> >          }
> >          if (fidp->fid_type != P9_FID_NONE) {
> >              err = -EINVAL;
> > @@ -3100,7 +3098,6 @@ out:
> >          put_fid(pdu, dirfidp);
> >      }
> >      v9fs_path_free(&new_path);
> > -out_nofid:
> >      return err;
> >  }
> 
> Same as with patch 44: IMO not any improvement, but also not any behaviour 
> change at least. So it's up to you Greg.
> 

I don't really care either but as you say it doesn't change behaviour, and
and the diffstat is nice :)

Acked-by: Greg Kurz <groug@kaod.org>

> Best regards,
> Christian Schoenebeck
> 
>
diff mbox series

Patch

diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 520177f40c..be2beba4cd 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -2464,8 +2464,7 @@  static int v9fs_xattr_write(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
 
 
     if (fidp->fs.xattr.len < off) {
-        err = -ENOSPC;
-        goto out;
+        return -ENOSPC;
     }
     write_count = fidp->fs.xattr.len - off;
     if (write_count > count) {
@@ -2491,7 +2490,7 @@  static int v9fs_xattr_write(V9fsState *s, V9fsPDU *pdu, V9fsFidState *fidp,
         off += to_copy;
         write_count -= to_copy;
     }
-out:
+
     return err;
 }
 
@@ -3056,8 +3055,7 @@  static int coroutine_fn v9fs_complete_rename(V9fsPDU *pdu, V9fsFidState *fidp,
     if (newdirfid != -1) {
         dirfidp = get_fid(pdu, newdirfid);
         if (dirfidp == NULL) {
-            err = -ENOENT;
-            goto out_nofid;
+            return -ENOENT;
         }
         if (fidp->fid_type != P9_FID_NONE) {
             err = -EINVAL;
@@ -3100,7 +3098,6 @@  out:
         put_fid(pdu, dirfidp);
     }
     v9fs_path_free(&new_path);
-out_nofid:
     return err;
 }