Replace existing ternary operators for finding minimum value with min_t macro to adhere to kernel coding standards and improve readability. Fix coccinelle warning: WARNING opportunity for min() Testing: Tested at runtime via sshfs with file creation, appendating and reading. Signed-off-by: Mahad Ibrahim --- fs/fuse/file.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index f94f3dc082c6..67bab59bc6a7 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1066,7 +1067,7 @@ static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file, return; } else { res = fuse_simple_request(fm, &ap->args); - err = res < 0 ? res : 0; + err = min_t(int, res, 0); } fuse_readpages_end(fm, &ap->args, err); } @@ -2895,7 +2896,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) if (io->async) { bool blocking = io->blocking; - fuse_aio_complete(io, ret < 0 ? ret : 0, -1); + fuse_aio_complete(io, min_t(int, ret, 0), -1); /* we have a non-extending, async request, so return */ if (!blocking) -- 2.47.3