From: Bartlomiej Zolnierkiewicz Date: Thu, 24 Jul 2008 20:53:34 +0000 (+0200) Subject: gayle: release resources on ide_host_add() failure X-Git-Tag: MMI-PSA29.97-13-9~33097^2~8 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=96cc112c09b3c6674da01ef8b377f7a916883ea2;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 Signed-off-by: Bartlomiej Zolnierkiewicz --- 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) unsigned long phys_base, res_start, res_n; unsigned long base, ctrlport, irqport; ide_ack_intr_t *ack_intr; - int a4000, i; + int a4000, i, rc; hw_regs_t hw[GAYLE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; if (!MACH_IS_AMIGA) @@ -179,7 +179,11 @@ found: hws[i] = &hw[i]; } - return ide_host_add(NULL, hws, NULL); + rc = ide_host_add(NULL, hws, NULL); + if (rc) + release_mem_region(res_start, res_n); + + return rc; } module_init(gayle_init);