[PATCH] ide/ide-cs: fix order of releasing resources

Wolfram Sang w.sang at pengutronix.de
Tue Jan 12 14:34:54 EST 2010


ide_detach() called first ide_release() and then release_region(). This
produced the following warnings:

  Trying to free nonexistent resource <000000000000c10e-000000000000c10e>
  Trying to free nonexistent resource <000000000000c100-000000000000c107>

This is true, because the callchain inside ide_release() is:

  ide_release -> pcmcia_disable_device -> pcmcia_release_io

So, the whole io-block is already gone for release_region(). To fix
this, just swap the order of releasing (and remove the now obsolete
shadowing).

Signed-off-by: Wolfram Sang <w.sang at pengutronix.de>
Cc: Dominik Brodowski <linux at dominikbrodowski.net>
Cc: Bartlomiej Zolnierkiewicz <bzolnier at gmail.com>
Cc: "David S. Miller" <davem at davemloft.net>
---
 drivers/ide/ide-cs.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index dd63963..43ed330 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -122,18 +122,14 @@ static void ide_detach(struct pcmcia_device *link)
 {
     ide_info_t *info = link->priv;
     ide_hwif_t *hwif = info->host->ports[0];
-    unsigned long data_addr, ctl_addr;
 
     dev_dbg(&link->dev, "ide_detach(0x%p)\n", link);
 
-    data_addr = hwif->io_ports.data_addr;
-    ctl_addr  = hwif->io_ports.ctl_addr;
+    release_region(hwif->io_ports.ctl_addr, 1);
+    release_region(hwif->io_ports.data_addr, 8);
 
     ide_release(link);
 
-    release_region(ctl_addr, 1);
-    release_region(data_addr, 8);
-
     kfree(info);
 } /* ide_detach */
 
-- 
1.6.3.3




More information about the linux-pcmcia mailing list