Skip to contentSkip to conversation

megaraid_mm: moved pci_pool_alloc() from critical section to outward

PATCH New Hirofumi Nakagawa 1 participant 1 message Aug 15, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 megaraid_mm: moved pci_pool_alloc() from critical section to outward

Hi
This patch moved call of pci_pool_alloc from critical section to outward. It seems like that original code behavior schedule-in without unlock.

Note
This patch is not tested because I don't have this device.

Thanks.
Hirofumi Nakagawa

---
 drivers/scsi/megaraid/megaraid_mm.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/scsi/megaraid/megaraid_mm.c +8 -5
index f680561..4d70906 100644
@@ -499,6 +499,7 @@ mraid_mm_attach_buf(mraid_mmadp_t *adp, uioc_t *kioc, int xferlen)
 	int		right_pool = -1;
 	unsigned long	flags;
 	int		i;
+	void *t;
 
 	kioc->pool_index	= -1;
 	kioc->buf_vaddr		= NULL;
@@ -549,17 +550,19 @@ mraid_mm_attach_buf(mraid_mmadp_t *adp, uioc_t *kioc, int xferlen)
 	 * to allocate one new buffer. NOTE: This is a blocking call.
 	 */
 	pool = &adp->dma_pool_list[right_pool];
+	t = pci_pool_alloc(pool->handle, GFP_KERNEL,
+							&kioc->buf_paddr);
+
+	if (!t)
+		return -ENOMEM;
 
 	spin_lock_irqsave(&pool->lock, flags);
 
 	kioc->pool_index	= right_pool;
 	kioc->free_buf		= 1;
-	kioc->buf_vaddr 	= pci_pool_alloc(pool->handle, GFP_KERNEL,
-							&kioc->buf_paddr);
-	spin_unlock_irqrestore(&pool->lock, flags);
+	kioc->buf_vaddr 	= t;
 
-	if (!kioc->buf_vaddr)
-		return -ENOMEM;
+	spin_unlock_irqrestore(&pool->lock, flags);
 
 	return 0;
 }