Skip to content

Commit 73c6da3

Browse files
Jiangshan Yikleikamp
authored andcommitted
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 <[email protected]> Signed-off-by: Dave Kleikamp <[email protected]>
1 parent 898f706 commit 73c6da3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/jfs/super.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,7 @@ static ssize_t jfs_quota_read(struct super_block *sb, int type, char *data,
745745
len = i_size-off;
746746
toread = len;
747747
while (toread > 0) {
748-
tocopy = sb->s_blocksize - offset < toread ?
749-
sb->s_blocksize - offset : toread;
748+
tocopy = min_t(size_t, sb->s_blocksize - offset, toread);
750749

751750
tmp_bh.b_state = 0;
752751
tmp_bh.b_size = i_blocksize(inode);
@@ -785,8 +784,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type,
785784

786785
inode_lock(inode);
787786
while (towrite > 0) {
788-
tocopy = sb->s_blocksize - offset < towrite ?
789-
sb->s_blocksize - offset : towrite;
787+
tocopy = min_t(size_t, sb->s_blocksize - offset, towrite);
790788

791789
tmp_bh.b_state = 0;
792790
tmp_bh.b_size = i_blocksize(inode);

0 commit comments

Comments
 (0)