mtd: blkdevs: fix switch-bool compilation warning

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Sep 1 14:59:05 PDT 2015


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=cc7fce80229067890365c1ee196be5d304d36dea
Commit:     cc7fce80229067890365c1ee196be5d304d36dea
Parent:     06bb6f5a69dfc53b79dd5f7afabdcd070a18afbf
Author:     Tomer Barletz <barletz at gmail.com>
AuthorDate: Tue Aug 4 21:00:24 2015 -0700
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Tue Aug 25 13:58:10 2015 -0700

    mtd: blkdevs: fix switch-bool compilation warning
    
    With gcc 5.1 I get:
    warning: switch condition has boolean value [-Wswitch-bool]
    
    Signed-off-by: Tomer Barletz <barletz at gmail.com>
    Signed-off-by: Brian Norris <computersforpeace at 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;
 	}
 }
 



More information about the linux-mtd-cvs mailing list