From: Xuelin Shi <xuelin....@freescale.com>

checking available slots in HW should be under the lock.

Signed-off-by: Xuelin Shi <b29...@freescale.com>
---
 drivers/dma/fsl_raid.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/fsl_raid.c b/drivers/dma/fsl_raid.c
index 935d05a..fccad86 100644
--- a/drivers/dma/fsl_raid.c
+++ b/drivers/dma/fsl_raid.c
@@ -112,11 +112,11 @@ static void re_jr_issue_pending(struct dma_chan *chan)
 
        jr = container_of(chan, struct re_jr, chan);
 
+       spin_lock_irqsave(&jr->desc_lock, flags);
        avail = RE_JR_INB_SLOT_AVAIL(in_be32(&jr->jrregs->inbring_slot_avail));
        if (!avail)
-               return;
+               goto out;
 
-       spin_lock_irqsave(&jr->desc_lock, flags);
        list_for_each_entry_safe(desc, _desc, &jr->submit_q, node) {
                if (!avail)
                        break;
@@ -132,6 +132,7 @@ static void re_jr_issue_pending(struct dma_chan *chan)
                out_be32(&jr->jrregs->inbring_add_job, RE_JR_INB_JOB_ADD(1));
                avail--;
        }
+out:
        spin_unlock_irqrestore(&jr->desc_lock, flags);
 }
 
-- 
1.9.1

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to