Bluetooth: Increase write data limit in l2cap connection.
[platform/kernel/linux-rpi.git] / drivers / parisc / sba_iommu.c
index e60690d..374b919 100644 (file)
@@ -1047,7 +1047,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
        spin_unlock_irqrestore(&ioc->res_lock, flags);
 #endif
 
-       while (sg_dma_len(sglist) && nents--) {
+       while (nents && sg_dma_len(sglist)) {
 
                sba_unmap_page(dev, sg_dma_address(sglist), sg_dma_len(sglist),
                                direction, 0);
@@ -1056,6 +1056,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
                ioc->usingle_calls--;   /* kluge since call is unmap_sg() */
 #endif
                ++sglist;
+               nents--;
        }
 
        DBG_RUN_SG("%s() DONE (nents %d)\n", __func__,  nents);