All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] powerpc/powernv: Free PHB instance upon error
@ 2013-07-31  8:47 Gavin Shan
  2013-07-31  8:47 ` [PATCH 2/5] powerpc/powernv: Fetch PHB bus range from dev-tree Gavin Shan
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Gavin Shan @ 2013-07-31  8:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Gavin Shan

We don't free PHB instance (struct pnv_phb) on error to creating
the associated PCI controler (struct pci_controller). The patch
fixes that. Also, the output messages have been cleaned for a bit
so that they looks unified for IODA_1/2 cases.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/powernv/pci-ioda.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index d8140b1..9cccdc7 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1113,7 +1113,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
 	void *aux;
 	long rc;
 
-	pr_info(" Initializing IODA%d OPAL PHB %s\n", ioda_type, np->full_name);
+	pr_info("Initializing IODA%d OPAL PHB %s\n", ioda_type, np->full_name);
 
 	prop64 = of_get_property(np, "ibm,opal-phbid", NULL);
 	if (!prop64) {
@@ -1124,13 +1124,18 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
 	pr_debug("  PHB-ID  : 0x%016llx\n", phb_id);
 
 	phb = alloc_bootmem(sizeof(struct pnv_phb));
-	if (phb) {
-		memset(phb, 0, sizeof(struct pnv_phb));
-		phb->hose = hose = pcibios_alloc_controller(np);
+	if (!phb) {
+		pr_err("  Out of memory !\n");
+		return;
 	}
-	if (!phb || !phb->hose) {
-		pr_err("PCI: Failed to allocate PCI controller for %s\n",
+
+	/* Allocate PCI controller */
+	memset(phb, 0, sizeof(struct pnv_phb));
+	phb->hose = hose = pcibios_alloc_controller(np);
+	if (!phb->hose) {
+		pr_err("  Can't allocate PCI controller for %s\n",
 		       np->full_name);
+		free_bootmem((unsigned long)phb, sizeof(struct pnv_phb));
 		return;
 	}
 
-- 
1.7.5.4

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

end of thread, other threads:[~2013-08-01  4:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-31  8:47 [PATCH 1/5] powerpc/powernv: Free PHB instance upon error Gavin Shan
2013-07-31  8:47 ` [PATCH 2/5] powerpc/powernv: Fetch PHB bus range from dev-tree Gavin Shan
2013-07-31  8:47 ` [PATCH 3/5] powerpc/powernv: Check primary PHB through ID Gavin Shan
2013-07-31  8:47 ` [PATCH 4/5] powerpc/powernv: Pick up correct number of PEs Gavin Shan
2013-07-31  9:18   ` Benjamin Herrenschmidt
2013-08-01  4:24     ` Gavin Shan
2013-08-01  4:42       ` Benjamin Herrenschmidt
2013-07-31  8:47 ` [PATCH 5/5] powerpc/powernv: Needn't IO segment map for PHB3 Gavin Shan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.