diff mbox series

UBIFS: simplify the return expression of run_gc()

Message ID 20220429054556.3851784-1-chi.minghao@zte.com.cn
State Accepted
Headers show
Series UBIFS: simplify the return expression of run_gc() | expand

Commit Message

CGEL April 29, 2022, 5:45 a.m. UTC
From: Minghao Chi <chi.minghao@zte.com.cn>

Simplify the return expression.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 fs/ubifs/budget.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Tudor Ambarus April 29, 2022, 7:02 a.m. UTC | #1
On 4/29/22 08:45, cgel.zte@gmail.com wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> Simplify the return expression.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>

> ---
>  fs/ubifs/budget.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c
> index c0b84e960b20..e8b9b756f0ac 100644
> --- a/fs/ubifs/budget.c
> +++ b/fs/ubifs/budget.c
> @@ -65,7 +65,7 @@ static void shrink_liability(struct ubifs_info *c, int nr_to_write)
>   */
>  static int run_gc(struct ubifs_info *c)
>  {
> -       int err, lnum;
> +       int lnum;
> 
>         /* Make some free space by garbage-collecting dirty space */
>         down_read(&c->commit_sem);
> @@ -76,10 +76,7 @@ static int run_gc(struct ubifs_info *c)
> 
>         /* GC freed one LEB, return it to lprops */
>         dbg_budg("GC freed LEB %d", lnum);
> -       err = ubifs_return_leb(c, lnum);
> -       if (err)
> -               return err;
> -       return 0;
> +       return ubifs_return_leb(c, lnum);
>  }
> 
>  /**
> --
> 2.25.1
> 
> 
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
diff mbox series

Patch

diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c
index c0b84e960b20..e8b9b756f0ac 100644
--- a/fs/ubifs/budget.c
+++ b/fs/ubifs/budget.c
@@ -65,7 +65,7 @@  static void shrink_liability(struct ubifs_info *c, int nr_to_write)
  */
 static int run_gc(struct ubifs_info *c)
 {
-	int err, lnum;
+	int lnum;
 
 	/* Make some free space by garbage-collecting dirty space */
 	down_read(&c->commit_sem);
@@ -76,10 +76,7 @@  static int run_gc(struct ubifs_info *c)
 
 	/* GC freed one LEB, return it to lprops */
 	dbg_budg("GC freed LEB %d", lnum);
-	err = ubifs_return_leb(c, lnum);
-	if (err)
-		return err;
-	return 0;
+	return ubifs_return_leb(c, lnum);
 }
 
 /**