summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJiangshan Yi <yijiangshan@kylinos.cn>2022-07-14 10:56:56 +0800
committerDave Kleikamp <dave.kleikamp@oracle.com>2022-10-18 08:50:26 -0500
commit73c6da327ff17a07a9260b0ff1f36e13665ac63d (patch)
treef76934495c30b99ca2a94685e1ad884228ce4593 /fs
parent898f706695682b9954f280d95e49fa86ffa55d08 (diff)
fs/jfs: replace ternary operator with min_t()
Fix the following coccicheck warning: fs/jfs/super.c:748: WARNING opportunity for min(). fs/jfs/super.c:788: WARNING opportunity for min(). 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: Dave Kleikamp <dave.kleikamp@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/jfs/super.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 85d4f44f2ac4..d2f82cb7db1b 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -745,8 +745,7 @@ static ssize_t jfs_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(size_t, sb->s_blocksize - offset, toread);
tmp_bh.b_state = 0;
tmp_bh.b_size = i_blocksize(inode);
@@ -785,8 +784,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type,
inode_lock(inode);
while (towrite > 0) {
- tocopy = sb->s_blocksize - offset < towrite ?
- sb->s_blocksize - offset : towrite;
+ tocopy = min_t(size_t, sb->s_blocksize - offset, towrite);
tmp_bh.b_state = 0;
tmp_bh.b_size = i_blocksize(inode);