]> git.baikalelectronics.ru Git - kernel.git/commitdiff
lightnvm: fix some WARN() messages
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 15 Apr 2017 18:55:52 +0000 (20:55 +0200)
committerJens Axboe <axboe@fb.com>
Sun, 16 Apr 2017 16:06:34 +0000 (10:06 -0600)
WARN_ON() takes a condition, not an error message.  I slightly tweaked
some conditions so hopefully it's more clear.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matias Bjørling <matias@cnexlabs.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/lightnvm/pblk-read.c
drivers/lightnvm/pblk-recovery.c
drivers/lightnvm/pblk-write.c

index eff0982c076f3a60ecca90738688f73405b6c992..bce7ed5fc73f32f4f4b33c1dc19b460c4ef00888 100644 (file)
@@ -49,8 +49,8 @@ static void pblk_read_ppalist_rq(struct pblk *pblk, struct nvm_rq *rqd,
        int i, j = 0;
 
        /* logic error: lba out-of-bounds. Ignore read request */
-       if (!(blba + nr_secs < pblk->rl.nr_secs)) {
-               WARN_ON("pblk: read lbas out of bounds\n");
+       if (blba + nr_secs >= pblk->rl.nr_secs) {
+               WARN(1, "pblk: read lbas out of bounds\n");
                return;
        }
 
@@ -254,8 +254,8 @@ static void pblk_read_rq(struct pblk *pblk, struct nvm_rq *rqd,
        sector_t lba = pblk_get_lba(bio);
 
        /* logic error: lba out-of-bounds. Ignore read request */
-       if (!(lba < pblk->rl.nr_secs)) {
-               WARN_ON("pblk: read lba out of bounds\n");
+       if (lba >= pblk->rl.nr_secs) {
+               WARN(1, "pblk: read lba out of bounds\n");
                return;
        }
 
@@ -411,8 +411,8 @@ static int read_rq_gc(struct pblk *pblk, struct nvm_rq *rqd,
        int valid_secs = 0;
 
        /* logic error: lba out-of-bounds */
-       if (!(lba < pblk->rl.nr_secs)) {
-               WARN_ON("pblk: read lba out of bounds\n");
+       if (lba >= pblk->rl.nr_secs) {
+               WARN(1, "pblk: read lba out of bounds\n");
                goto out;
        }
 
index 0d50f415cfde9a058fa573c82a3fd9afe0266d83..f8f85087cd3c2bab3342158638405e8f4b76d642 100644 (file)
@@ -167,7 +167,7 @@ static int pblk_recov_l2p_from_emeta(struct pblk *pblk, struct pblk_line *line)
                if (le64_to_cpu(lba_list[i]) == ADDR_EMPTY) {
                        spin_lock(&line->lock);
                        if (test_and_set_bit(i, line->invalid_bitmap))
-                               WARN_ON_ONCE("pblk: rec. double invalidate:\n");
+                               WARN_ONCE(1, "pblk: rec. double invalidate:\n");
                        else
                                line->vsc--;
                        spin_unlock(&line->lock);
index ee57db993cd18f529da30e81c80a59903b6d7408..74f7413a6b207628e4af4a438ac9676b85b1660f 100644 (file)
@@ -141,7 +141,7 @@ static void pblk_end_w_fail(struct pblk *pblk, struct nvm_rq *rqd)
 
                /* Logic error */
                if (bit > c_ctx->nr_valid) {
-                       WARN_ON_ONCE("pblk: corrupted write request\n");
+                       WARN_ONCE(1, "pblk: corrupted write request\n");
                        goto out;
                }