diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-24 16:53:34 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-24 16:53:34 -0400 |
commit | 96cc112c09b3c6674da01ef8b377f7a916883ea2 (patch) | |
tree | 48bc76aaf41a75b5d8bde9184912a2ab74abbc3e /drivers/ide/legacy | |
parent | a0f403bc58dcaa118f02ec70c3ecfec1bc26e445 (diff) |
gayle: release resources on ide_host_add() failure
"gayle: reserve memory resources at once" patch temporary removed
freeing of resources on failure (to ease convertion to ide_host_add()
interface). This patch fixes it.
Thanks to Geert for noticing the issue.
Noticed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy')
-rw-r--r-- | drivers/ide/legacy/gayle.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c index dd5c467d8dd0..51ba085d7aa8 100644 --- a/drivers/ide/legacy/gayle.c +++ b/drivers/ide/legacy/gayle.c | |||
@@ -127,7 +127,7 @@ static int __init gayle_init(void) | |||
127 | unsigned long phys_base, res_start, res_n; | 127 | unsigned long phys_base, res_start, res_n; |
128 | unsigned long base, ctrlport, irqport; | 128 | unsigned long base, ctrlport, irqport; |
129 | ide_ack_intr_t *ack_intr; | 129 | ide_ack_intr_t *ack_intr; |
130 | int a4000, i; | 130 | int a4000, i, rc; |
131 | hw_regs_t hw[GAYLE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; | 131 | hw_regs_t hw[GAYLE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; |
132 | 132 | ||
133 | if (!MACH_IS_AMIGA) | 133 | if (!MACH_IS_AMIGA) |
@@ -179,7 +179,11 @@ found: | |||
179 | hws[i] = &hw[i]; | 179 | hws[i] = &hw[i]; |
180 | } | 180 | } |
181 | 181 | ||
182 | return ide_host_add(NULL, hws, NULL); | 182 | rc = ide_host_add(NULL, hws, NULL); |
183 | if (rc) | ||
184 | release_mem_region(res_start, res_n); | ||
185 | |||
186 | return rc; | ||
183 | } | 187 | } |
184 | 188 | ||
185 | module_init(gayle_init); | 189 | module_init(gayle_init); |