All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lightnvm: pblk: fix error codes in pblk_submit_read_gc()
@ 2017-10-18  7:42 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-10-18  7:42 UTC (permalink / raw)
  To: Matias Bjorling, Javier González; +Cc: linux-block, kernel-janitors

There is a missing error code if pblk_bio_map_addr() fails.  This
function used to return NVM_IO_ERR on error and it still returns
NVM_IO_OK (which is zero) on success, but now it returns negative error
codes on failure.  I decided to use a standard error code and remove the
reference to NVM_IO_OK so that no one was confused.

Fixes: d340121eb770 ("lightnvm: pblk: simplify data validity check on GC")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index ca79d8fb3e60..c26f527dbf86 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -528,7 +528,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
 	struct bio *bio;
 	struct nvm_rq rqd;
 	int data_len;
-	int ret = NVM_IO_OK;
+	int ret;
 
 	memset(&rqd, 0, sizeof(struct nvm_rq));
 
@@ -561,6 +561,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
 						PBLK_VMALLOC_META, GFP_KERNEL);
 	if (IS_ERR(bio)) {
 		pr_err("pblk: could not allocate GC bio (%lu)\n", PTR_ERR(bio));
+		ret = PTR_ERR(bio);
 		goto err_free_dma;
 	}
 
@@ -595,7 +596,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
 
 out:
 	nvm_dev_dma_free(dev->parent, rqd.meta_list, rqd.dma_meta_list);
-	return ret;
+	return 0;
 
 err_free_bio:
 	bio_put(bio);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-18  7:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-18  7:42 [PATCH] lightnvm: pblk: fix error codes in pblk_submit_read_gc() Dan Carpenter
2017-10-18  7:42 ` Dan Carpenter
2017-10-18  7:49 ` Javier González
2017-10-18  7:49   ` Javier González

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.