mtd: blkdevs: fix switch-bool compilation warning
authorTomer Barletz <barletz@gmail.com>
Wed, 5 Aug 2015 04:00:24 +0000 (21:00 -0700)
committerBrian Norris <computersforpeace@gmail.com>
Tue, 25 Aug 2015 20:58:10 +0000 (13:58 -0700)
With gcc 5.1 I get:
warning: switch condition has boolean value [-Wswitch-bool]

Signed-off-by: Tomer Barletz <barletz@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/mtd_blkdevs.c

index 41acc507b22ed942bee2f0df6f43dda073efeb99..88304751eb8a9f1be47e3838d80fd4782cbf862c 100644 (file)
@@ -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;
        }
 }