diff options
author | Om Narasimhan <om.turyx@gmail.com> | 2006-10-20 14:44:15 -0700 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-10-25 21:59:42 -0400 |
commit | a230a6785dd5af84b8b043a64d8df8adc81f3724 (patch) | |
tree | f882cb5538776f5aa8a88731f7e34a8f2887e3c9 /drivers/pcmcia/au1000_generic.c | |
parent | f465ce176fb2f1778a04fc3fcb2b8aa564901419 (diff) | |
download | kernel_goldelico_gta04-a230a6785dd5af84b8b043a64d8df8adc81f3724.zip kernel_goldelico_gta04-a230a6785dd5af84b8b043a64d8df8adc81f3724.tar.gz kernel_goldelico_gta04-a230a6785dd5af84b8b043a64d8df8adc81f3724.tar.bz2 |
[PATCH] pcmcia: au1000_generic fix
The previous code did something like,
if (error) goto out_err;
....
do {
struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
del_timer_sync(&skt->poll_timer);
pcmcia_unregister_socket(&skt->socket);
out_err:
flush_scheduled_work();
ops->hw_shutdown(skt);
i--;
} while (i > 0)
.....
- On the error path, skt would not contain a valid value for the first
iteration (skt is masked by uninitialized automatic skt)
- Does not do hw_shutdown() for 0th element of PCMCIA_SOCKET
Signed-off-by: Om Narasimhan <om.turyx@gmail.com>
Cc: "Yoichi Yuasa" <yoichi_yuasa@tripeaks.co.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/au1000_generic.c')
-rw-r--r-- | drivers/pcmcia/au1000_generic.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c index d5dd0ce..5387de6 100644 --- a/drivers/pcmcia/au1000_generic.c +++ b/drivers/pcmcia/au1000_generic.c @@ -351,6 +351,7 @@ struct skt_dev_info { int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr) { struct skt_dev_info *sinfo; + struct au1000_pcmcia_socket *skt; int ret, i; sinfo = kzalloc(sizeof(struct skt_dev_info), GFP_KERNEL); @@ -365,7 +366,7 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, * Initialise the per-socket structure. */ for (i = 0; i < nr; i++) { - struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); + skt = PCMCIA_SOCKET(i); memset(skt, 0, sizeof(*skt)); skt->socket.resource_ops = &pccard_static_ops; @@ -438,17 +439,19 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, dev_set_drvdata(dev, sinfo); return 0; - do { - struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); + +out_err: + flush_scheduled_work(); + ops->hw_shutdown(skt); + while (i-- > 0) { + skt = PCMCIA_SOCKET(i); del_timer_sync(&skt->poll_timer); pcmcia_unregister_socket(&skt->socket); -out_err: flush_scheduled_work(); ops->hw_shutdown(skt); - i--; - } while (i > 0); + } kfree(sinfo); out: return ret; |