diff options
author | Jiangshan Yi <yijiangshan@kylinos.cn> | 2022-08-19 09:52:40 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2022-08-19 11:06:08 +0200 |
commit | e03d3b1b924cbaac91ddf066e4d14a2c4d3ed1d1 (patch) | |
tree | 31d17df76d9b97e1291635ad05b62f28047d3d99 /fs/reiserfs/super.c | |
parent | Merge tag 'net-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netd... (diff) | |
download | linux-e03d3b1b924cbaac91ddf066e4d14a2c4d3ed1d1.tar.xz linux-e03d3b1b924cbaac91ddf066e4d14a2c4d3ed1d1.zip |
fs/reiserfs: replace ternary operator with min() and min_t()
Fix the following coccicheck warning:
fs/reiserfs/prints.c:459: WARNING opportunity for min().
fs/reiserfs/resize.c:100: WARNING opportunity for min().
fs/reiserfs/super.c:2508: WARNING opportunity for min().
fs/reiserfs/super.c:2557: WARNING opportunity for min().
min() 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.
Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220819075240.3199477-1-13667453960@163.com
Diffstat (limited to 'fs/reiserfs/super.c')
-rw-r--r-- | fs/reiserfs/super.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index c88cd2ce0665..da1e72494e30 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -2504,9 +2504,7 @@ static ssize_t reiserfs_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); tmp_bh.b_state = 0; /* * Quota files are without tails so we can safely @@ -2554,8 +2552,7 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type, return -EIO; } while (towrite > 0) { - tocopy = sb->s_blocksize - offset < towrite ? - sb->s_blocksize - offset : towrite; + tocopy = min_t(unsigned long, sb->s_blocksize - offset, towrite); tmp_bh.b_state = 0; reiserfs_write_lock(sb); err = reiserfs_get_block(inode, blk, &tmp_bh, GET_BLOCK_CREATE); |