[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20110605082016.5a26f61a.ken_kawasaki@spring.nifty.jp>
Date: Sun, 5 Jun 2011 08:20:16 +0900
From: Ken Kawasaki <ken_kawasaki@...ing.nifty.jp>
To: netdev@...r.kernel.org
Subject: [PATCH kernel 3.0-rc1] smc91c92_cs: set smc->base to NULL before
iounmap
smc91c92_cs:
set smc->base to NULL before iounmap
to avoid writing to smc->base in smc_interrupt.
Signed-off-by: Ken Kawasaki <ken_kawasaki@...ing.nifty.jp>
---
--- linux-3.0-rc1/drivers/net/pcmcia/smc91c92_cs.c.orig 2011-06-04 19:38:07.000000000 +0900
+++ linux-3.0-rc1/drivers/net/pcmcia/smc91c92_cs.c 2011-06-05 07:59:51.000000000 +0900
@@ -315,6 +315,7 @@ static int smc91c92_probe(struct pcmcia_
smc = netdev_priv(dev);
smc->p_dev = link;
link->priv = dev;
+ smc->base = NULL;
spin_lock_init(&smc->lock);
@@ -954,11 +955,17 @@ config_failed:
static void smc91c92_release(struct pcmcia_device *link)
{
+ struct net_device *dev = link->priv;
+ struct smc_private *smc = netdev_priv(dev);
+
dev_dbg(&link->dev, "smc91c92_release\n");
- if (link->resource[2]->end) {
- struct net_device *dev = link->priv;
- struct smc_private *smc = netdev_priv(dev);
- iounmap(smc->base);
+
+ if (smc->base != NULL) {
+ u_char __iomem *tmp;
+
+ tmp = smc->base;
+ smc->base = NULL; /* set NULL before iounmap */
+ iounmap(tmp);
}
pcmcia_disable_device(link);
}
@@ -1444,7 +1451,7 @@ irq_done:
mask_bits(0x00ff, ioaddr-0x10+OSITECH_RESET_ISR);
set_bits(0x0300, ioaddr-0x10+OSITECH_RESET_ISR);
}
- if (smc->manfid == MANFID_MOTOROLA) {
+ if ((smc->base != NULL) && (smc->manfid == MANFID_MOTOROLA)) {
u_char cor;
cor = readb(smc->base + MOT_UART + CISREG_COR);
writeb(cor & ~COR_IREQ_ENA, smc->base + MOT_UART + CISREG_COR);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists