[IA64]: SN fix bus->sysdata pointer and memory cleanups

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.

Signed-off-by: Prarit Bhargava <prarit@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>

authored by Prarit Bhargava and committed by Tony Luck c1ffb910 12aaa085

+10 -8
+10 -8
arch/ia64/sn/kernel/io_init.c
··· 322 struct pci_controller *controller; 323 struct pcibus_bussoft *prom_bussoft_ptr; 324 struct hubdev_info *hubdev_info; 325 - void *provider_soft; 326 struct sn_pcibus_provider *provider; 327 328 status = sal_get_pcibus_info((u64) segment, (u64) busnum, ··· 338 if (bus == NULL) { 339 bus = pci_scan_bus(busnum, &pci_root_ops, controller); 340 if (bus == NULL) 341 - return; /* error, or bus already scanned */ 342 bus->sysdata = NULL; 343 } 344 ··· 351 */ 352 353 if (prom_bussoft_ptr->bs_asic_type >= PCIIO_ASIC_MAX_TYPES) 354 - return; /* unsupported asic type */ 355 356 if (prom_bussoft_ptr->bs_asic_type == PCIIO_ASIC_TYPE_PPB) 357 goto error_return; /* no further fixup necessary */ 358 359 provider = sn_pci_provider[prom_bussoft_ptr->bs_asic_type]; 360 if (provider == NULL) 361 - return; /* no provider registerd for this asic */ 362 363 - provider_soft = NULL; 364 if (provider->bus_fixup) 365 provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr, controller); 366 367 - if (provider_soft == NULL) 368 - return; /* fixup failed or not applicable */ 369 370 /* 371 * Generic bus fixup goes here. Don't reference prom_bussoft_ptr 372 * after this point. 373 */ 374 375 - bus->sysdata = controller; 376 PCI_CONTROLLER(bus)->platform_data = provider_soft; 377 nasid = NASID_GET(SN_PCIBUS_BUSSOFT(bus)->bs_base); 378 cnode = nasid_to_cnodeid(nasid);
··· 322 struct pci_controller *controller; 323 struct pcibus_bussoft *prom_bussoft_ptr; 324 struct hubdev_info *hubdev_info; 325 + void *provider_soft = NULL; 326 struct sn_pcibus_provider *provider; 327 328 status = sal_get_pcibus_info((u64) segment, (u64) busnum, ··· 338 if (bus == NULL) { 339 bus = pci_scan_bus(busnum, &pci_root_ops, controller); 340 if (bus == NULL) 341 + goto error_return; /* error, or bus already scanned */ 342 bus->sysdata = NULL; 343 } 344 ··· 351 */ 352 353 if (prom_bussoft_ptr->bs_asic_type >= PCIIO_ASIC_MAX_TYPES) 354 + goto error_return; /* unsupported asic type */ 355 356 if (prom_bussoft_ptr->bs_asic_type == PCIIO_ASIC_TYPE_PPB) 357 goto error_return; /* no further fixup necessary */ 358 359 provider = sn_pci_provider[prom_bussoft_ptr->bs_asic_type]; 360 if (provider == NULL) 361 + goto error_return; /* no provider registerd for this asic */ 362 363 + bus->sysdata = controller; 364 if (provider->bus_fixup) 365 provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr, controller); 366 367 + if (provider_soft == NULL) { 368 + /* fixup failed or not applicable */ 369 + bus->sysdata = NULL; 370 + goto error_return; 371 + } 372 373 /* 374 * Generic bus fixup goes here. Don't reference prom_bussoft_ptr 375 * after this point. 376 */ 377 378 PCI_CONTROLLER(bus)->platform_data = provider_soft; 379 nasid = NASID_GET(SN_PCIBUS_BUSSOFT(bus)->bs_base); 380 cnode = nasid_to_cnodeid(nasid);