aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/arm
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:59 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:59 -0400
commit8a69580e1ea9516caada5eed202afd39546e9809 (patch)
treefb300fb7d67e09470a2654811baaa7832fec2fae /drivers/ide/arm
parent18de10170df31d34b342612f1c896a16a52f0a5c (diff)
ide: add ide_host_free() helper (take 2)
* Add ide_host_free() helper and convert ide_host_remove() to use it. * Fix handling of ide_host_register() failure in ide_host_add(), icside.c, ide-generic.c, falconide.c and sgiioc4.c. While at it: * Fix handling of ide_host_alloc_all() failure in ide-generic.c. * Fix handling of ide_host_alloc() failure in falconide.c (also return the correct error value if no device is found). v2: * falconide build fix. (From Stephen Rothwell) Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/arm')
-rw-r--r--drivers/ide/arm/icside.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index 6fa58425466a..f575e8341aec 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -445,6 +445,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
445 void __iomem *base; 445 void __iomem *base;
446 struct ide_host *host; 446 struct ide_host *host;
447 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 447 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
448 int ret;
448 449
449 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); 450 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
450 if (!base) 451 if (!base)
@@ -472,9 +473,15 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
472 473
473 ecard_set_drvdata(ec, state); 474 ecard_set_drvdata(ec, state);
474 475
475 ide_host_register(host, NULL, hws); 476 ret = ide_host_register(host, NULL, hws);
477 if (ret)
478 goto err_free;
476 479
477 return 0; 480 return 0;
481err_free:
482 ide_host_free(host);
483 ecard_set_drvdata(ec, NULL);
484 return ret;
478} 485}
479 486
480static const struct ide_port_info icside_v6_port_info __initdata = { 487static const struct ide_port_info icside_v6_port_info __initdata = {
@@ -547,11 +554,17 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
547 d.dma_ops = NULL; 554 d.dma_ops = NULL;
548 } 555 }
549 556
550 ide_host_register(host, &d, hws); 557 ret = ide_host_register(host, NULL, hws);
558 if (ret)
559 goto err_free;
551 560
552 return 0; 561 return 0;
553 562err_free:
554 out: 563 ide_host_free(host);
564 if (d.dma_ops)
565 free_dma(ec->dma);
566 ecard_set_drvdata(ec, NULL);
567out:
555 return ret; 568 return ret;
556} 569}
557 570