mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Kent Overstreet <kent.overstreet@gmail.com>,
	Jens Axboe <axboe@fb.com>, Joern Engel <joern@logfs.org>,
	Prasad Joshi <prasadjoshi.linux@gmail.com>
Cc: logfs@logfs.org, linux-kernel@vger.kernel.org,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH] logfs: Use min_t() to compare different types
Date: Fri,  4 Sep 2015 12:50:59 +0200	[thread overview]
Message-ID: <1441363859-20979-1-git-send-email-geert@linux-m68k.org> (raw)

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@linux-m68k.org>
---
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


                 reply	other threads:[~2015-09-04 10:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441363859-20979-1-git-send-email-geert@linux-m68k.org \
    --to=geert@linux-m68k.org \
    --cc=axboe@fb.com \
    --cc=joern@logfs.org \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=logfs@logfs.org \
    --cc=prasadjoshi.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®