summaryrefslogtreecommitdiff
path: root/drivers/char/pcmcia/cm4040_cs.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2007-05-09 13:33:31 +0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-09 23:30:49 +0400
commit54493c10069741a02cd34c2b44a6bfdb85e7de6a (patch)
tree21c3d853bb7af8b7f5b1f77ebdab0e8922c3e49c /drivers/char/pcmcia/cm4040_cs.c
parent8813d1c00ca923c1683da625ff85959be1db9a49 (diff)
downloadlinux-54493c10069741a02cd34c2b44a6bfdb85e7de6a.tar.xz
cm4000_cs: fix error paths
This patch fixes error paths in module_init and probe functions in cm4000_cs and cm4040_cs drivers. Cc: Harald Welte <laforge@gnumonks.org> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/pcmcia/cm4040_cs.c')
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index f2e4ec4fd407..af88181a17f4 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -636,8 +636,11 @@ static int reader_probe(struct pcmcia_device *link)
setup_timer(&dev->poll_timer, cm4040_do_poll, 0);
ret = reader_config(link, i);
- if (ret)
+ if (ret) {
+ dev_table[i] = NULL;
+ kfree(dev);
return ret;
+ }
class_device_create(cmx_class, NULL, MKDEV(major, i), NULL,
"cmx%d", i);
@@ -708,12 +711,14 @@ static int __init cm4040_init(void)
if (major < 0) {
printk(KERN_WARNING MODULE_NAME
": could not get major number\n");
+ class_destroy(cmx_class);
return major;
}
rc = pcmcia_register_driver(&reader_driver);
if (rc < 0) {
unregister_chrdev(major, DEVICE_NAME);
+ class_destroy(cmx_class);
return rc;
}