f2fs: replace ternary operator with max()

Message ID 44b06118.3c.18424382765.Coremail.wangkailong@jari.cn
State New
Headers
Series f2fs: replace ternary operator with max() |

Commit Message

KaiLong Wang Oct. 29, 2022, 2:49 p.m. UTC
  Fix the following coccicheck warning:

./fs/f2fs/segment.c:877:24-25: WARNING opportunity for max()

Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
---
 fs/f2fs/segment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Chao Yu Nov. 1, 2022, 3:38 p.m. UTC | #1
On 2022/10/29 22:49, wangkailong@jari.cn wrote:
> Fix the following coccicheck warning:
> 
> ./fs/f2fs/segment.c:877:24-25: WARNING opportunity for max()
> 
> Signed-off-by: KaiLong Wang <wangkailong@jari.cn>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,
  

Patch

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index ada21e83d279..6da92518328c 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -874,7 +874,7 @@  block_t f2fs_get_unusable_blocks(struct f2fs_sb_info *sbi)
 	}
 	mutex_unlock(&dirty_i->seglist_lock);
 
-	unusable = holes[DATA] > holes[NODE] ? holes[DATA] : holes[NODE];
+	unusable = max(holes[DATA], holes[NODE]);
 	if (unusable > ovp_holes)
 		return unusable - ovp_holes;
 	return 0;