mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] xfs: remove redundant else for clean code
@ 2022-08-23  1:47 Zeng Heng
  2022-08-23 14:26 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Zeng Heng @ 2022-08-23  1:47 UTC (permalink / raw)
  To: djwong; +Cc: linux-xfs, linux-kernel

"else" is not generally useful after a return, so remove it for clean code.

There is no logical changes.

Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
 fs/xfs/xfs_log.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 386b0307aed8..f6e7e4fd72ae 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -226,12 +226,12 @@ xlog_ticket_reservation(
 	if (head == &log->l_write_head) {
 		ASSERT(tic->t_flags & XLOG_TIC_PERM_RESERV);
 		return tic->t_unit_res;
-	} else {
-		if (tic->t_flags & XLOG_TIC_PERM_RESERV)
-			return tic->t_unit_res * tic->t_cnt;
-		else
-			return tic->t_unit_res;
 	}
+
+	if (tic->t_flags & XLOG_TIC_PERM_RESERV)
+		return tic->t_unit_res * tic->t_cnt;
+
+	return tic->t_unit_res;
 }
 
 STATIC bool
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] xfs: remove redundant else for clean code
  2022-08-23  1:47 [PATCH -next] xfs: remove redundant else for clean code Zeng Heng
@ 2022-08-23 14:26 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2022-08-23 14:26 UTC (permalink / raw)
  To: Zeng Heng; +Cc: linux-xfs, linux-kernel

On Tue, Aug 23, 2022 at 09:47:45AM +0800, Zeng Heng wrote:
> "else" is not generally useful after a return, so remove it for clean code.
> 
> There is no logical changes.
> 
> Signed-off-by: Zeng Heng <zengheng4@huawei.com>
> ---
>  fs/xfs/xfs_log.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 386b0307aed8..f6e7e4fd72ae 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -226,12 +226,12 @@ xlog_ticket_reservation(
>  	if (head == &log->l_write_head) {
>  		ASSERT(tic->t_flags & XLOG_TIC_PERM_RESERV);
>  		return tic->t_unit_res;
> -	} else {
> -		if (tic->t_flags & XLOG_TIC_PERM_RESERV)
> -			return tic->t_unit_res * tic->t_cnt;
> -		else
> -			return tic->t_unit_res;
>  	}
> +
> +	if (tic->t_flags & XLOG_TIC_PERM_RESERV)
> +		return tic->t_unit_res * tic->t_cnt;
> +
> +	return tic->t_unit_res;

I think this looks correct
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

>  }
>  
>  STATIC bool
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-23 16:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-23  1:47 [PATCH -next] xfs: remove redundant else for clean code Zeng Heng
2022-08-23 14:26 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®