Skip to contentSkip to conversation

allocation fix in ppc/platforms/4xx/luan.c

PATCH New Roel Kluin 1 participant 1 message Oct 27, 2007

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 allocation fix in ppc/platforms/4xx/luan.c

Don't allocate hose2 when when hose1 can't be allocated and free hose1 when hose2 can't be allocated.

---

arch/ppc/platforms/4xx/luan.c +6 -1
index 4b16961..b79ebb8 100644
@@ -230,9 +230,14 @@ luan_setup_hoses(void)
 
 	/* Allocate hoses for PCIX1 and PCIX2 */
 	hose1 = pcibios_alloc_controller();
+	if (!hose1)
+		return;
+
 	hose2 = pcibios_alloc_controller();
-	if (!hose1 || !hose2)
+	if (!hose2) {
+		pcibios_free_controller(hose1);
 		return;
+	}
 
 	/* Setup PCIX1 */
 	hose1->first_busno = 0;