diff options
author | 2022-08-17 10:59:28 +0800 | |
---|---|---|
committer | 2022-11-29 16:10:49 -0500 | |
commit | 66267814ba0ee0732c69ca87eb1fd6eb63bf0d5f (patch) | |
tree | 204a4c8a28740257bd95d86ff1e209d31587a65b /fs/ext4/inline.c | |
parent | ext4: check and assert if marking an no_delete evicting inode dirty (diff) | |
download | linux-66267814ba0ee0732c69ca87eb1fd6eb63bf0d5f.tar.gz linux-66267814ba0ee0732c69ca87eb1fd6eb63bf0d5f.tar.bz2 linux-66267814ba0ee0732c69ca87eb1fd6eb63bf0d5f.zip |
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>
Diffstat (limited to 'fs/ext4/inline.c')
-rw-r--r-- | fs/ext4/inline.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index a4fbe825694b..2b42ececa46d 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -180,8 +180,7 @@ static int ext4_read_inline_data(struct inode *inode, void *buffer, BUG_ON(len > EXT4_I(inode)->i_inline_size); - cp_len = len < EXT4_MIN_INLINE_DATA_SIZE ? - len : EXT4_MIN_INLINE_DATA_SIZE; + cp_len = min_t(unsigned int, len, EXT4_MIN_INLINE_DATA_SIZE); raw_inode = ext4_raw_inode(iloc); memcpy(buffer, (void *)(raw_inode->i_block), cp_len); |