From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Linux/m68k <linux-m68k@vger.kernel.org>,
Linux Kernel Development <linux-kernel@vger.kernel.org>,
Roel Kluin <12o3l@tiscali.nl>
Subject: [patch 03/13] m68k: Balance ioremap and iounmap in m68k/atari/hades-pci.c
Date: Sun, 18 Nov 2007 11:13:39 +0100 [thread overview]
Message-ID: <20071118101447.046732847@mail.of.borg> (raw)
In-Reply-To: 20071118101336.330321764@mail.of.borg
[-- Attachment #1: atari-hades-pci-balance-iomap-and-iounmap.diff --]
[-- Type: text/plain, Size: 2949 bytes --]
From: Roel Kluin <12o3l@tiscali.nl>
m68k: Balance ioremap and iounmap in m68k/atari/hades-pci.c
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
arch/m68k/atari/hades-pci.c | 56 +++++++++++++++++++++-----------------------
1 file changed, 27 insertions(+), 29 deletions(-)
--- 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_
*/
bus = kzalloc(sizeof(struct pci_bus_info), GFP_KERNEL);
- if (!bus)
- return NULL;
+ if (unlikely(!bus))
+ goto iounmap_base_virt;
/*
* Claim resources. The m68k has no separate I/O space, both
@@ -385,43 +385,25 @@ struct pci_bus_info * __init init_hades_
* the I/O resources are requested in memory space as well.
*/
- if (request_resource(&iomem_resource, &config_space) != 0)
- {
- kfree(bus);
- return NULL;
- }
-
- if (request_resource(&iomem_resource, &io_space) != 0)
- {
- release_resource(&config_space);
- kfree(bus);
- return NULL;
- }
+ if (unlikely(request_resource(&iomem_resource, &config_space) != 0))
+ goto free_bus;
+
+ if (unlikely(request_resource(&iomem_resource, &io_space) != 0))
+ goto release_config_space;
bus->mem_space.start = HADES_MEM_BASE;
bus->mem_space.end = HADES_MEM_BASE + HADES_MEM_SIZE - 1;
bus->mem_space.name = pci_mem_name;
#if 1
- if (request_resource(&iomem_resource, &bus->mem_space) != 0)
- {
- release_resource(&io_space);
- release_resource(&config_space);
- kfree(bus);
- return NULL;
- }
+ if (unlikely(request_resource(&iomem_resource, &bus->mem_space) != 0))
+ goto release_io_space;
#endif
bus->io_space.start = pci_io_base_virt;
bus->io_space.end = pci_io_base_virt + HADES_VIRT_IO_SIZE - 1;
bus->io_space.name = pci_io_name;
#if 1
- if (request_resource(&ioport_resource, &bus->io_space) != 0)
- {
- release_resource(&bus->mem_space);
- release_resource(&io_space);
- release_resource(&config_space);
- kfree(bus);
- return NULL;
- }
+ if (unlikely(request_resource(&ioport_resource, &bus->io_space) != 0))
+ goto release_bus_mem_space;
#endif
/*
* Set hardware dependent functions.
@@ -438,5 +420,21 @@ struct pci_bus_info * __init init_hades_
tt_mfp.active_edge &= ~0x27;
return bus;
+
+release_bus_mem_space:
+ release_resource(&bus->mem_space);
+release_io_space:
+ release_resource(&io_space);
+release_config_space:
+ release_resource(&config_space);
+free_bus:
+ kfree(bus);
+iounmap_base_virt:
+ iounmap((void *)pci_io_base_virt);
+
+ for (i = 0; i < N_SLOTS; i++)
+ iounmap((void *)pci_conf_base_virt[i]);
+
+ return NULL;
}
#endif
--
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2007-11-18 10:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-18 10:13 [patch 00/13] m68k patches for 2.6.25 Geert Uytterhoeven
2007-11-18 10:13 ` [patch 01/13] m68k: ARRAY_SIZE() cleanup Geert Uytterhoeven
2007-11-18 10:13 ` [patch 02/13] dio: " Geert Uytterhoeven
2007-11-20 21:46 ` Richard Knutsson
2007-11-21 7:52 ` Geert Uytterhoeven
2007-11-18 10:13 ` Geert Uytterhoeven [this message]
2007-11-18 10:13 ` [patch 04/13] nubus: kill drivers/nubus/nubus_syms.c Geert Uytterhoeven
2007-11-18 10:13 ` [patch 05/13] m68k: kill arch/m68k/mac/mac_ksyms.c Geert Uytterhoeven
2007-11-18 10:13 ` [patch 06/13] m68k: kill arch/m68k/hp300/ksyms.c Geert Uytterhoeven
2007-11-18 10:13 ` [patch 07/13] m68k: kill arch/m68k/amiga/amiga_ksyms.c Geert Uytterhoeven
2007-11-18 10:13 ` [patch 08/13] m68k: kill arch/m68k/atari/atari_ksyms.c Geert Uytterhoeven
2007-11-18 10:13 ` [patch 09/13] m68k: kill arch/m68k/mvme16x/mvme16x_ksyms.c Geert Uytterhoeven
2007-11-18 10:13 ` [patch 10/13] mac68k: macii adb comment correction Geert Uytterhoeven
2007-11-18 10:13 ` [patch 11/13] mac68k: remove dead code Geert Uytterhoeven
2007-11-18 10:13 ` [patch 12/13] mac68k: add nubus card definitions and a typo fix Geert Uytterhoeven
2007-11-18 10:13 ` [patch 13/13] mac68k: remove dead MAC_ADBKEYCODES Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071118101447.046732847@mail.of.borg \
--to=geert@linux-m68k.org \
--cc=12o3l@tiscali.nl \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.