From 47bc7e7425d198ad1f8c4597b0bf28619fcce0fd Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Wed, 16 Jul 2008 20:33:44 +0200 Subject: [PATCH] rapide: fix rapide_probe() return value Return -ENOENT on ide_find_port() failure. While at it: - Cleanup rapide_probe() a bit. Cc: Russell King Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/arm/rapide.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c index bb081ad53f31..43057e0303c8 100644 --- a/drivers/ide/arm/rapide.c +++ b/drivers/ide/arm/rapide.c @@ -48,25 +48,27 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) goto release; } + memset(&hw, 0, sizeof(hw)); + rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq); + hw.chipset = ide_generic; + hw.dev = &ec->dev; + hwif = ide_find_port(); - if (hwif) { - memset(&hw, 0, sizeof(hw)); - rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq); - hw.chipset = ide_generic; - hw.dev = &ec->dev; - - ide_init_port_hw(hwif, &hw); - - default_hwif_mmiops(hwif); - - idx[0] = hwif->index; - - ide_device_add(idx, &rapide_port_info); - - ecard_set_drvdata(ec, hwif); - goto out; + if (hwif == NULL) { + ret = -ENOENT; + goto release; } + ide_init_port_hw(hwif, &hw); + default_hwif_mmiops(hwif); + + idx[0] = hwif->index; + + ide_device_add(idx, &rapide_port_info); + + ecard_set_drvdata(ec, hwif); + goto out; + release: ecard_release_resources(ec); out: