瀏覽代碼

[POWERPC] 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.

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Roel Kluin 18 年之前
父節點
當前提交
57d75561be
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      arch/ppc/platforms/4xx/luan.c

+ 6 - 1
arch/ppc/platforms/4xx/luan.c

@@ -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;