diff options
-rw-r--r-- | arch/m68k/atari/hades-pci.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/arch/m68k/atari/hades-pci.c b/arch/m68k/atari/hades-pci.c index bee2b1443e36..2bbabc008708 100644 --- a/arch/m68k/atari/hades-pci.c +++ b/arch/m68k/atari/hades-pci.c | |||
@@ -376,8 +376,8 @@ struct pci_bus_info * __init init_hades_pci(void) | |||
376 | */ | 376 | */ |
377 | 377 | ||
378 | bus = kzalloc(sizeof(struct pci_bus_info), GFP_KERNEL); | 378 | bus = kzalloc(sizeof(struct pci_bus_info), GFP_KERNEL); |
379 | if (!bus) | 379 | if (unlikely(!bus)) |
380 | return NULL; | 380 | goto iounmap_base_virt; |
381 | 381 | ||
382 | /* | 382 | /* |
383 | * Claim resources. The m68k has no separate I/O space, both | 383 | * Claim resources. The m68k has no separate I/O space, both |
@@ -385,43 +385,25 @@ struct pci_bus_info * __init init_hades_pci(void) | |||
385 | * the I/O resources are requested in memory space as well. | 385 | * the I/O resources are requested in memory space as well. |
386 | */ | 386 | */ |
387 | 387 | ||
388 | if (request_resource(&iomem_resource, &config_space) != 0) | 388 | if (unlikely(request_resource(&iomem_resource, &config_space) != 0)) |
389 | { | 389 | goto free_bus; |
390 | kfree(bus); | ||
391 | return NULL; | ||
392 | } | ||
393 | 390 | ||
394 | if (request_resource(&iomem_resource, &io_space) != 0) | 391 | if (unlikely(request_resource(&iomem_resource, &io_space) != 0)) |
395 | { | 392 | goto release_config_space; |
396 | release_resource(&config_space); | ||
397 | kfree(bus); | ||
398 | return NULL; | ||
399 | } | ||
400 | 393 | ||
401 | bus->mem_space.start = HADES_MEM_BASE; | 394 | bus->mem_space.start = HADES_MEM_BASE; |
402 | bus->mem_space.end = HADES_MEM_BASE + HADES_MEM_SIZE - 1; | 395 | bus->mem_space.end = HADES_MEM_BASE + HADES_MEM_SIZE - 1; |
403 | bus->mem_space.name = pci_mem_name; | 396 | bus->mem_space.name = pci_mem_name; |
404 | #if 1 | 397 | #if 1 |
405 | if (request_resource(&iomem_resource, &bus->mem_space) != 0) | 398 | if (unlikely(request_resource(&iomem_resource, &bus->mem_space) != 0)) |
406 | { | 399 | goto release_io_space; |
407 | release_resource(&io_space); | ||
408 | release_resource(&config_space); | ||
409 | kfree(bus); | ||
410 | return NULL; | ||
411 | } | ||
412 | #endif | 400 | #endif |
413 | bus->io_space.start = pci_io_base_virt; | 401 | bus->io_space.start = pci_io_base_virt; |
414 | bus->io_space.end = pci_io_base_virt + HADES_VIRT_IO_SIZE - 1; | 402 | bus->io_space.end = pci_io_base_virt + HADES_VIRT_IO_SIZE - 1; |
415 | bus->io_space.name = pci_io_name; | 403 | bus->io_space.name = pci_io_name; |
416 | #if 1 | 404 | #if 1 |
417 | if (request_resource(&ioport_resource, &bus->io_space) != 0) | 405 | if (unlikely(request_resource(&ioport_resource, &bus->io_space) != 0)) |
418 | { | 406 | goto release_bus_mem_space; |
419 | release_resource(&bus->mem_space); | ||
420 | release_resource(&io_space); | ||
421 | release_resource(&config_space); | ||
422 | kfree(bus); | ||
423 | return NULL; | ||
424 | } | ||
425 | #endif | 407 | #endif |
426 | /* | 408 | /* |
427 | * Set hardware dependent functions. | 409 | * Set hardware dependent functions. |
@@ -438,5 +420,21 @@ struct pci_bus_info * __init init_hades_pci(void) | |||
438 | tt_mfp.active_edge &= ~0x27; | 420 | tt_mfp.active_edge &= ~0x27; |
439 | 421 | ||
440 | return bus; | 422 | return bus; |
423 | |||
424 | release_bus_mem_space: | ||
425 | release_resource(&bus->mem_space); | ||
426 | release_io_space: | ||
427 | release_resource(&io_space); | ||
428 | release_config_space: | ||
429 | release_resource(&config_space); | ||
430 | free_bus: | ||
431 | kfree(bus); | ||
432 | iounmap_base_virt: | ||
433 | iounmap((void *)pci_io_base_virt); | ||
434 | |||
435 | for (i = 0; i < N_SLOTS; i++) | ||
436 | iounmap((void *)pci_conf_base_virt[i]); | ||
437 | |||
438 | return NULL; | ||
441 | } | 439 | } |
442 | #endif | 440 | #endif |