[PATCH] logfs: Use min_t() to compare different types

From: Geert Uytterhoeven
Date: Fri Sep 04 2015 - 06:51:04 EST


fs/logfs/dev_bdev.c: In function â__bdev_writesegâ:
fs/logfs/dev_bdev.c:84: warning: comparison of distinct pointer types lacks a cast
fs/logfs/dev_bdev.c: In function âdo_eraseâ:
fs/logfs/dev_bdev.c:174: warning: comparison of distinct pointer types lacks a cast

Until b54ffb73cadcdcff ("block: remove bio_get_nr_vecs()") there were
explicit casts to "size_t" to avoid compiler warnings. Use
"min_t(size_t, ...)" instead.

Fixes: b54ffb73cadcdcff ("block: remove bio_get_nr_vecs()").
Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
---
The nearby code desperately needs some int/unsigned int/size_t cleanups
(e.g. an "int" loop counter with a "size_t" limit?).
---
fs/logfs/dev_bdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c
index a7fdbd86847453ac..a709d80c8ebcc783 100644
--- a/fs/logfs/dev_bdev.c
+++ b/fs/logfs/dev_bdev.c
@@ -81,7 +81,7 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
unsigned int max_pages;
int i;

- max_pages = min(nr_pages, BIO_MAX_PAGES);
+ max_pages = min_t(size_t, nr_pages, BIO_MAX_PAGES);

bio = bio_alloc(GFP_NOFS, max_pages);
BUG_ON(!bio);
@@ -171,7 +171,7 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index,
unsigned int max_pages;
int i;

- max_pages = min(nr_pages, BIO_MAX_PAGES);
+ max_pages = min_t(size_t, nr_pages, BIO_MAX_PAGES);

bio = bio_alloc(GFP_NOFS, max_pages);
BUG_ON(!bio);
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/