diff options
author | Jiangshan Yi <yijiangshan@kylinos.cn> | 2022-08-17 05:59:28 +0300 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2022-11-30 00:10:49 +0300 |
commit | 66267814ba0ee0732c69ca87eb1fd6eb63bf0d5f (patch) | |
tree | 204a4c8a28740257bd95d86ff1e209d31587a65b /fs/ext4/super.c | |
parent | 318cdc822c63b6e2befcfdc2088378ae6fa18def (diff) | |
download | linux-66267814ba0ee0732c69ca87eb1fd6eb63bf0d5f.tar.xz |
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/super.c')
-rw-r--r-- | fs/ext4/super.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 7cdd2138c897..4749b303f2a9 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -7031,8 +7031,7 @@ static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data, len = i_size-off; toread = len; while (toread > 0) { - tocopy = sb->s_blocksize - offset < toread ? - sb->s_blocksize - offset : toread; + tocopy = min_t(unsigned long, sb->s_blocksize - offset, toread); bh = ext4_bread(NULL, inode, blk, 0); if (IS_ERR(bh)) return PTR_ERR(bh); |