public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] sparc64: enable IRQs on error paths
@ 2016-11-25 11:12 Dan Carpenter
  2016-11-25 12:32 ` Sowmini Varadhan
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Dan Carpenter @ 2016-11-25 11:12 UTC (permalink / raw)
  To: kernel-janitors

There are several error paths where we should enable IRQs but we don't.

Fixes: bb620c3d3925 ("sparc: Make sparc64 use scalable lib/iommu-common.c functions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Not tested.

diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 06981cc7..274df7a 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -230,12 +230,16 @@ static void *dma_4v_alloc_coherent(struct device *dev, size_t size,
 
 	for (n = 0; n < npages; n++) {
 		long err = iommu_batch_add(first_page + (n * PAGE_SIZE), mask);
-		if (unlikely(err < 0L))
+		if (unlikely(err < 0L)) {
+			local_irq_restore(flags);
 			goto iommu_map_fail;
+		}
 	}
 
-	if (unlikely(iommu_batch_end(mask) < 0L))
+	if (unlikely(iommu_batch_end(mask) < 0L)) {
+		local_irq_restore(flags);
 		goto iommu_map_fail;
+	}
 
 	local_irq_restore(flags);
 
@@ -398,11 +402,15 @@ static dma_addr_t dma_4v_map_page(struct device *dev, struct page *page,
 
 	for (i = 0; i < npages; i++, base_paddr += IO_PAGE_SIZE) {
 		long err = iommu_batch_add(base_paddr, mask);
-		if (unlikely(err < 0L))
+		if (unlikely(err < 0L)) {
+			local_irq_restore(flags);
 			goto iommu_map_fail;
+		}
 	}
-	if (unlikely(iommu_batch_end(mask) < 0L))
+	if (unlikely(iommu_batch_end(mask) < 0L)) {
+		local_irq_restore(flags);
 		goto iommu_map_fail;
+	}
 
 	local_irq_restore(flags);
 

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-11-25 21:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-25 11:12 [patch] sparc64: enable IRQs on error paths Dan Carpenter
2016-11-25 12:32 ` Sowmini Varadhan
2016-11-25 13:01 ` Dan Carpenter
2016-11-25 13:11 ` Sowmini Varadhan
2016-11-25 13:46 ` Dan Carpenter
2016-11-25 13:57 ` Sowmini Varadhan
2016-11-25 20:45 ` Sam Ravnborg
2016-11-25 21:06 ` tndave
2016-11-25 21:11 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox