[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1504695071-25928-5-git-send-email-javier@cnexlabs.com>
Date: Wed, 6 Sep 2017 12:50:57 +0200
From: "Javier González" <jg@...htnvm.io>
To: mb@...htnvm.io, axboe@...com
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
Javier González <javier@...xlabs.com>,
Matias Bjørling <matias@...xlabs.com>
Subject: [PATCH 04/18] lightnvm: pblk: check for failed mempool alloc.
Check for failed mempool allocations and act accordingly.
Signed-off-by: Javier González <javier@...xlabs.com>
Signed-off-by: Matias Bjørling <matias@...xlabs.com>
---
drivers/lightnvm/pblk-core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index e3997abdf740..11a684162a5d 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -165,6 +165,8 @@ struct nvm_rq *pblk_alloc_rqd(struct pblk *pblk, int rw)
}
rqd = mempool_alloc(pool, GFP_KERNEL);
+ if (!rqd)
+ return NULL;
memset(rqd, 0, rq_size);
return rqd;
@@ -1478,6 +1480,8 @@ int pblk_blk_erase_async(struct pblk *pblk, struct ppa_addr ppa)
int err;
rqd = mempool_alloc(pblk->g_rq_pool, GFP_KERNEL);
+ if (!rqd)
+ return -ENOMEM;
memset(rqd, 0, pblk_g_rq_size);
pblk_setup_e_rq(pblk, rqd, ppa);
--
2.7.4
Powered by blists - more mailing lists