* [PATCH 0/2] Fix a return value + some cleanups
@ 2017-06-11 6:40 Christophe JAILLET
2017-06-11 6:40 ` [PATCH 1/2] scsi: qedi: Fix a return value in case of error in 'qedi_alloc_global_queues' Christophe JAILLET
2017-06-11 6:40 ` [PATCH 2/2] scsi: qedi: Use 'dma_zalloc_coherent' to reduce code verbosity Christophe JAILLET
0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2017-06-11 6:40 UTC (permalink / raw)
To: QLogic-Storage-Upstream, jejb, martin.petersen
Cc: linux-scsi, linux-kernel, kernel-janitors, Christophe JAILLET
This patch serie first fixes a case where an error code was missing.
The other path is just a cleanup in the same area.
Christophe JAILLET (2):
scsi: qedi: Fix a return value in case of error in
'qedi_alloc_global_queues'
scsi: qedi: Use 'dma_zalloc_coherent' to reduce code verbosity.
drivers/scsi/qedi/qedi_main.c | 40 +++++++++++++++++-----------------------
1 file changed, 17 insertions(+), 23 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/2] scsi: qedi: Fix a return value in case of error in 'qedi_alloc_global_queues' 2017-06-11 6:40 [PATCH 0/2] Fix a return value + some cleanups Christophe JAILLET @ 2017-06-11 6:40 ` Christophe JAILLET 2017-06-11 8:34 ` walter harms 2017-06-11 6:40 ` [PATCH 2/2] scsi: qedi: Use 'dma_zalloc_coherent' to reduce code verbosity Christophe JAILLET 1 sibling, 1 reply; 4+ messages in thread From: Christophe JAILLET @ 2017-06-11 6:40 UTC (permalink / raw) To: QLogic-Storage-Upstream, jejb, martin.petersen Cc: linux-scsi, linux-kernel, kernel-janitors, Christophe JAILLET We should return -ENOMEM in case of memory allocation error, as done elsewhere in this function. Fixes: ace7f46ba5fde ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> --- drivers/scsi/qedi/qedi_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index f46880315ba8..c81e494a9067 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -1319,6 +1319,7 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) if (!qedi->global_queues[i]) { QEDI_ERR(&qedi->dbg_ctx, "Unable to allocation global queue %d.\n", i); + status = -ENOMEM; goto mem_alloc_failure; } -- 2.11.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] scsi: qedi: Fix a return value in case of error in 'qedi_alloc_global_queues' 2017-06-11 6:40 ` [PATCH 1/2] scsi: qedi: Fix a return value in case of error in 'qedi_alloc_global_queues' Christophe JAILLET @ 2017-06-11 8:34 ` walter harms 0 siblings, 0 replies; 4+ messages in thread From: walter harms @ 2017-06-11 8:34 UTC (permalink / raw) To: Christophe JAILLET Cc: QLogic-Storage-Upstream, jejb, martin.petersen, linux-scsi, linux-kernel, kernel-janitors Am 11.06.2017 08:40, schrieb Christophe JAILLET: > We should return -ENOMEM in case of memory allocation error, as done > elsewhere in this function. > > Fixes: ace7f46ba5fde ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.") > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- > drivers/scsi/qedi/qedi_main.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c > index f46880315ba8..c81e494a9067 100644 > --- a/drivers/scsi/qedi/qedi_main.c > +++ b/drivers/scsi/qedi/qedi_main.c > @@ -1319,6 +1319,7 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) > if (!qedi->global_queues[i]) { > QEDI_ERR(&qedi->dbg_ctx, > "Unable to allocation global queue %d.\n", i); > + status = -ENOMEM; > goto mem_alloc_failure; > } > copy of "[PATCH 1/3] scsi: qedf: Fix a return value in case ..." ? same strange error message re, wh ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] scsi: qedi: Use 'dma_zalloc_coherent' to reduce code verbosity. 2017-06-11 6:40 [PATCH 0/2] Fix a return value + some cleanups Christophe JAILLET 2017-06-11 6:40 ` [PATCH 1/2] scsi: qedi: Fix a return value in case of error in 'qedi_alloc_global_queues' Christophe JAILLET @ 2017-06-11 6:40 ` Christophe JAILLET 1 sibling, 0 replies; 4+ messages in thread From: Christophe JAILLET @ 2017-06-11 6:40 UTC (permalink / raw) To: QLogic-Storage-Upstream, jejb, martin.petersen Cc: linux-scsi, linux-kernel, kernel-janitors, Christophe JAILLET Replace some 'dma_alloc_coherent+memset' by some quivalent 'dma_zalloc_coherent' in order to reduce code verbosity Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> --- This patch generates some checkpatch errors about the use of space to indent code. I've left it as-is to keep consistency with the style used in this file. --- drivers/scsi/qedi/qedi_main.c | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index c81e494a9067..37bf881ccfb3 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -1241,16 +1241,15 @@ static int qedi_alloc_bdq(struct qedi_ctx *qedi) } /* Allocate list of PBL pages */ - qedi->bdq_pbl_list = dma_alloc_coherent(&qedi->pdev->dev, - PAGE_SIZE, - &qedi->bdq_pbl_list_dma, - GFP_KERNEL); + qedi->bdq_pbl_list = dma_zalloc_coherent(&qedi->pdev->dev, + PAGE_SIZE, + &qedi->bdq_pbl_list_dma, + GFP_KERNEL); if (!qedi->bdq_pbl_list) { QEDI_ERR(&qedi->dbg_ctx, "Could not allocate list of PBL pages.\n"); return -ENOMEM; } - memset(qedi->bdq_pbl_list, 0, PAGE_SIZE); /* * Now populate PBL list with pages that contain pointers to the @@ -1337,10 +1336,10 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) (QEDI_PAGE_SIZE - 1)); qedi->global_queues[i]->cq = - dma_alloc_coherent(&qedi->pdev->dev, - qedi->global_queues[i]->cq_mem_size, - &qedi->global_queues[i]->cq_dma, - GFP_KERNEL); + dma_zalloc_coherent(&qedi->pdev->dev, + qedi->global_queues[i]->cq_mem_size, + &qedi->global_queues[i]->cq_dma, + GFP_KERNEL); if (!qedi->global_queues[i]->cq) { QEDI_WARN(&qedi->dbg_ctx, @@ -1348,14 +1347,12 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) status = -ENOMEM; goto mem_alloc_failure; } - memset(qedi->global_queues[i]->cq, 0, - qedi->global_queues[i]->cq_mem_size); qedi->global_queues[i]->cq_pbl = - dma_alloc_coherent(&qedi->pdev->dev, - qedi->global_queues[i]->cq_pbl_size, - &qedi->global_queues[i]->cq_pbl_dma, - GFP_KERNEL); + dma_zalloc_coherent(&qedi->pdev->dev, + qedi->global_queues[i]->cq_pbl_size, + &qedi->global_queues[i]->cq_pbl_dma, + GFP_KERNEL); if (!qedi->global_queues[i]->cq_pbl) { QEDI_WARN(&qedi->dbg_ctx, @@ -1363,8 +1360,6 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi) status = -ENOMEM; goto mem_alloc_failure; } - memset(qedi->global_queues[i]->cq_pbl, 0, - qedi->global_queues[i]->cq_pbl_size); /* Create PBL */ num_pages = qedi->global_queues[i]->cq_mem_size / @@ -1425,25 +1420,23 @@ int qedi_alloc_sq(struct qedi_ctx *qedi, struct qedi_endpoint *ep) ep->sq_pbl_size = (ep->sq_mem_size / QEDI_PAGE_SIZE) * sizeof(void *); ep->sq_pbl_size = ep->sq_pbl_size + QEDI_PAGE_SIZE; - ep->sq = dma_alloc_coherent(&qedi->pdev->dev, ep->sq_mem_size, - &ep->sq_dma, GFP_KERNEL); + ep->sq = dma_zalloc_coherent(&qedi->pdev->dev, ep->sq_mem_size, + &ep->sq_dma, GFP_KERNEL); if (!ep->sq) { QEDI_WARN(&qedi->dbg_ctx, "Could not allocate send queue.\n"); rval = -ENOMEM; goto out; } - memset(ep->sq, 0, ep->sq_mem_size); - ep->sq_pbl = dma_alloc_coherent(&qedi->pdev->dev, ep->sq_pbl_size, - &ep->sq_pbl_dma, GFP_KERNEL); + ep->sq_pbl = dma_zalloc_coherent(&qedi->pdev->dev, ep->sq_pbl_size, + &ep->sq_pbl_dma, GFP_KERNEL); if (!ep->sq_pbl) { QEDI_WARN(&qedi->dbg_ctx, "Could not allocate send queue PBL.\n"); rval = -ENOMEM; goto out_free_sq; } - memset(ep->sq_pbl, 0, ep->sq_pbl_size); /* Create PBL */ num_pages = ep->sq_mem_size / QEDI_PAGE_SIZE; -- 2.11.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-11 8:34 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-06-11 6:40 [PATCH 0/2] Fix a return value + some cleanups Christophe JAILLET 2017-06-11 6:40 ` [PATCH 1/2] scsi: qedi: Fix a return value in case of error in 'qedi_alloc_global_queues' Christophe JAILLET 2017-06-11 8:34 ` walter harms 2017-06-11 6:40 ` [PATCH 2/2] scsi: qedi: Use 'dma_zalloc_coherent' to reduce code verbosity Christophe JAILLET
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).