From 7a330f2e091253371fe76daf3612bd3a4afb174f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 30 Nov 2009 10:59:40 +0000 Subject: [PATCH] Should have been included in the previous commit (r1371). git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1372 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 6fd675a58..a8a833bbf 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -2311,11 +2311,6 @@ static void srpt_unmap_sg_to_ib_sge(struct srpt_rdma_ch *ch, struct scatterlist *scat; scst_data_direction dir; - scmnd = ioctx->scmnd; - BUG_ON(!scmnd); - BUG_ON(ioctx != scst_cmd_get_tgt_priv(scmnd)); - scat = scst_cmd_get_sg(scmnd); - BUG_ON(ioctx->n_rdma && !ioctx->rdma_ius); while (ioctx->n_rdma) @@ -2324,11 +2319,16 @@ static void srpt_unmap_sg_to_ib_sge(struct srpt_rdma_ch *ch, kfree(ioctx->rdma_ius); ioctx->rdma_ius = NULL; - if (scat) { - dir = scst_cmd_get_data_direction(scmnd); - ib_dma_unmap_sg(ch->sport->sdev->device, - scat, scst_cmd_get_sg_cnt(scmnd), - scst_to_tgt_dma_dir(dir)); + scmnd = ioctx->scmnd; + if (scmnd) { + BUG_ON(ioctx != scst_cmd_get_tgt_priv(scmnd)); + scat = scst_cmd_get_sg(scmnd); + if (scat) { + dir = scst_cmd_get_data_direction(scmnd); + ib_dma_unmap_sg(ch->sport->sdev->device, + scat, scst_cmd_get_sg_cnt(scmnd), + scst_to_tgt_dma_dir(dir)); + } } }