Skip to content

Commit 2a79efd

Browse files
Dan Carpenteraxboe
authored andcommitted
lightnvm: fix some WARN() messages
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 <[email protected]> Signed-off-by: Matias Bjørling <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 503ec94 commit 2a79efd

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

drivers/lightnvm/pblk-read.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ static void pblk_read_ppalist_rq(struct pblk *pblk, struct nvm_rq *rqd,
4949
int i, j = 0;
5050

5151
/* logic error: lba out-of-bounds. Ignore read request */
52-
if (!(blba + nr_secs < pblk->rl.nr_secs)) {
53-
WARN_ON("pblk: read lbas out of bounds\n");
52+
if (blba + nr_secs >= pblk->rl.nr_secs) {
53+
WARN(1, "pblk: read lbas out of bounds\n");
5454
return;
5555
}
5656

@@ -254,8 +254,8 @@ static void pblk_read_rq(struct pblk *pblk, struct nvm_rq *rqd,
254254
sector_t lba = pblk_get_lba(bio);
255255

256256
/* logic error: lba out-of-bounds. Ignore read request */
257-
if (!(lba < pblk->rl.nr_secs)) {
258-
WARN_ON("pblk: read lba out of bounds\n");
257+
if (lba >= pblk->rl.nr_secs) {
258+
WARN(1, "pblk: read lba out of bounds\n");
259259
return;
260260
}
261261

@@ -411,8 +411,8 @@ static int read_rq_gc(struct pblk *pblk, struct nvm_rq *rqd,
411411
int valid_secs = 0;
412412

413413
/* logic error: lba out-of-bounds */
414-
if (!(lba < pblk->rl.nr_secs)) {
415-
WARN_ON("pblk: read lba out of bounds\n");
414+
if (lba >= pblk->rl.nr_secs) {
415+
WARN(1, "pblk: read lba out of bounds\n");
416416
goto out;
417417
}
418418

drivers/lightnvm/pblk-recovery.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static int pblk_recov_l2p_from_emeta(struct pblk *pblk, struct pblk_line *line)
167167
if (le64_to_cpu(lba_list[i]) == ADDR_EMPTY) {
168168
spin_lock(&line->lock);
169169
if (test_and_set_bit(i, line->invalid_bitmap))
170-
WARN_ON_ONCE("pblk: rec. double invalidate:\n");
170+
WARN_ONCE(1, "pblk: rec. double invalidate:\n");
171171
else
172172
line->vsc--;
173173
spin_unlock(&line->lock);

drivers/lightnvm/pblk-write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static void pblk_end_w_fail(struct pblk *pblk, struct nvm_rq *rqd)
141141

142142
/* Logic error */
143143
if (bit > c_ctx->nr_valid) {
144-
WARN_ON_ONCE("pblk: corrupted write request\n");
144+
WARN_ONCE(1, "pblk: corrupted write request\n");
145145
goto out;
146146
}
147147

0 commit comments

Comments
 (0)