]> git.baikalelectronics.ru Git - kernel.git/commitdiff
lightnvm: fix type checks on rrpc
authorJavier González <jg@lightnvm.io>
Sat, 15 Apr 2017 18:55:48 +0000 (20:55 +0200)
committerJens Axboe <axboe@fb.com>
Sun, 16 Apr 2017 16:06:25 +0000 (10:06 -0600)
sector_t is always unsigned, therefore avoid < 0 checks on it.

Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <matias@cnexlabs.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/lightnvm/rrpc.c

index 5dba54470c2ae4f794303e27a7ad5dbc8313117c..cf0e28a0ff61d34844b629f7c22e3625f1efe2bf 100644 (file)
@@ -817,7 +817,7 @@ static int rrpc_read_ppalist_rq(struct rrpc *rrpc, struct bio *bio,
 
        for (i = 0; i < npages; i++) {
                /* We assume that mapping occurs at 4KB granularity */
-               BUG_ON(!(laddr + i >= 0 && laddr + i < rrpc->nr_sects));
+               BUG_ON(!(laddr + i < rrpc->nr_sects));
                gp = &rrpc->trans_map[laddr + i];
 
                if (gp->rblk) {
@@ -846,7 +846,7 @@ static int rrpc_read_rq(struct rrpc *rrpc, struct bio *bio, struct nvm_rq *rqd,
        if (!is_gc && rrpc_lock_rq(rrpc, bio, rqd))
                return NVM_IO_REQUEUE;
 
-       BUG_ON(!(laddr >= 0 && laddr < rrpc->nr_sects));
+       BUG_ON(!(laddr < rrpc->nr_sects));
        gp = &rrpc->trans_map[laddr];
 
        if (gp->rblk) {