All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: SN fix bus->sysdata pointer and memory cleanups
@ 2005-08-02 17:08 Prarit Bhargava
  0 siblings, 0 replies; only message in thread
From: Prarit Bhargava @ 2005-08-02 17:08 UTC (permalink / raw)
  To: linux-ia64

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

This patch fixes two things

The main issue is that bus_fixup calls may potentially call
functions that require a valid bus->sysdata pointer.  Since
this is the case, we must set the bus->sysdata pointer before
calling the bus_fixup functions.  The remaining changes are
simple fixes to make sure memory is cleaned up in the function.

This patch was generated against Tony Luck's latest ia64 tree.

Signed-off-by: Prarit Bhargava <prarit@sgi.com>

P.

[-- Attachment #2: tioca_fixup.patch --]
[-- Type: text/plain, Size: 2411 bytes --]

This patch fixes two things

The main issue is that bus_fixup calls may potentially call
functions that require a valid bus->sysdata pointer.  Since
this is the case, we must set the bus->sysdata pointer before
calling the bus_fixup functions.  The remaining changes are
simple fixes to make sure memory is cleaned up in the function.

This patch was generated against Tony Luck's latest ia64 tree.

Signed-off-by: Prarit Bhargava <prarit@sgi.com>

diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -322,7 +322,7 @@ void sn_pci_controller_fixup(int segment
 	struct pci_controller *controller;
 	struct pcibus_bussoft *prom_bussoft_ptr;
 	struct hubdev_info *hubdev_info;
-	void *provider_soft;
+	void *provider_soft = NULL;
 	struct sn_pcibus_provider *provider;
 
  	status = sal_get_pcibus_info((u64) segment, (u64) busnum,
@@ -338,7 +338,7 @@ void sn_pci_controller_fixup(int segment
 	if (bus == NULL) {
  		bus = pci_scan_bus(busnum, &pci_root_ops, controller);
  		if (bus == NULL)
- 			return;	/* error, or bus already scanned */
+ 			goto error_return; /* error, or bus already scanned */
  		bus->sysdata = NULL;
 	}
 
@@ -351,28 +351,30 @@ void sn_pci_controller_fixup(int segment
 	 */
 
 	if (prom_bussoft_ptr->bs_asic_type >= PCIIO_ASIC_MAX_TYPES)
-		return;		/* unsupported asic type */
+		goto error_return; /* unsupported asic type */
 
 	if (prom_bussoft_ptr->bs_asic_type == PCIIO_ASIC_TYPE_PPB)
 		goto error_return; /* no further fixup necessary */
 
 	provider = sn_pci_provider[prom_bussoft_ptr->bs_asic_type];
 	if (provider == NULL)
-		return;		/* no provider registerd for this asic */
+		goto error_return; /* no provider registerd for this asic */
 
-	provider_soft = NULL;
+	bus->sysdata = controller;
 	if (provider->bus_fixup)
 		provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr, controller);
 
-	if (provider_soft == NULL)
-		return;		/* fixup failed or not applicable */
+	if (provider_soft == NULL) {
+		/* fixup failed or not applicable */
+		bus->sysdata = NULL;
+		goto error_return;
+	}
 
 	/*
 	 * Generic bus fixup goes here.  Don't reference prom_bussoft_ptr
 	 * after this point.
 	 */
 
-	bus->sysdata = controller;
 	PCI_CONTROLLER(bus)->platform_data = provider_soft;
 	nasid = NASID_GET(SN_PCIBUS_BUSSOFT(bus)->bs_base);
 	cnode = nasid_to_cnodeid(nasid);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-08-02 17:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-02 17:08 [PATCH]: SN fix bus->sysdata pointer and memory cleanups Prarit Bhargava

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.