fs/ext4: replace ternary operator with min()/max() and min_t()
authorJiangshan Yi <yijiangshan@kylinos.cn>
Wed, 17 Aug 2022 02:59:28 +0000 (10:59 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 29 Nov 2022 21:10:49 +0000 (16:10 -0500)
commit66267814ba0ee0732c69ca87eb1fd6eb63bf0d5f
tree204a4c8a28740257bd95d86ff1e209d31587a65b
parent318cdc822c63b6e2befcfdc2088378ae6fa18def
fs/ext4: replace ternary operator with min()/max() and min_t()

Fix the following coccicheck warning:

fs/ext4/inline.c:183: WARNING opportunity for min().
fs/ext4/extents.c:2631: WARNING opportunity for max().
fs/ext4/extents.c:2632: WARNING opportunity for min().
fs/ext4/extents.c:5559: WARNING opportunity for max().
fs/ext4/super.c:6908: WARNING opportunity for min().

min()/max() and min_t() macro is defined in include/linux/minmax.h.
It avoids multiple evaluations of the arguments when non-constant and
performs strict type-checking.

Reported-by: kernel test robot <lkp@intel.com>
Suggested-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Link: https://lore.kernel.org/r/20220817025928.612851-1-13667453960@163.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents.c
fs/ext4/inline.c
fs/ext4/super.c