Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1200382

[PATCH] mtd: Fix switch-bool compilation warning

From Tomer Barletz <barletz@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] mtd: Fix switch-bool compilation warning
Date 2015-08-05 06:10 +0200
Message-ID <pTYbE-6Oi-5@gated-at.bofh.it> (permalink)
References <pT1XY-5NL-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


With gcc 5.1 I get:
warning: switch condition has boolean value [-Wswitch-bool]

Signed-off-by: Tomer Barletz <barletz@gmail.com>
---
 drivers/mtd/mtd_blkdevs.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 41acc50..8830475 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -97,14 +97,13 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr,
 	if (req->cmd_flags & REQ_DISCARD)
 		return tr->discard(dev, block, nsect);
 
-	switch(rq_data_dir(req)) {
-	case READ:
+	if (rq_data_dir(req) == READ) {
 		for (; nsect > 0; nsect--, block++, buf += tr->blksize)
 			if (tr->readsect(dev, block, buf))
 				return -EIO;
 		rq_flush_dcache_pages(req);
 		return 0;
-	case WRITE:
+	} else {
 		if (!tr->writesect)
 			return -EIO;
 
@@ -113,9 +112,6 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr,
 			if (tr->writesect(dev, block, buf))
 				return -EIO;
 		return 0;
-	default:
-		printk(KERN_NOTICE "Unknown request %u\n", rq_data_dir(req));
-		return -EIO;
 	}
 }
 
-- 
2.4.3

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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] Avoid compiler warning by storing the result of rq_data_dir() in an int variable Tomer Barletz <barletz@gmail.com> - 2015-08-02 12:40 +0200
  Re: [PATCH] Avoid compiler warning by storing the result of  rq_data_dir() in an int variable Hagen Paul Pfeifer <hagen@jauu.net> - 2015-08-02 16:00 +0200
    [PATCH] Avoid compiler warning by storing the result of rq_data_dir() in an int variable Tomer Barletz <barletz@gmail.com> - 2015-08-03 08:00 +0200
    [PATCH] mtd: Fix switch-bool compilation warning Tomer Barletz <barletz@gmail.com> - 2015-08-05 06:10 +0200

csiph-web