diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2007-05-09 05:33:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 15:30:49 -0400 |
commit | 54493c10069741a02cd34c2b44a6bfdb85e7de6a (patch) | |
tree | 21c3d853bb7af8b7f5b1f77ebdab0e8922c3e49c /drivers/char/pcmcia/cm4040_cs.c | |
parent | 8813d1c00ca923c1683da625ff85959be1db9a49 (diff) |
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.c | 7 |
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) | |||
636 | setup_timer(&dev->poll_timer, cm4040_do_poll, 0); | 636 | setup_timer(&dev->poll_timer, cm4040_do_poll, 0); |
637 | 637 | ||
638 | ret = reader_config(link, i); | 638 | ret = reader_config(link, i); |
639 | if (ret) | 639 | if (ret) { |
640 | dev_table[i] = NULL; | ||
641 | kfree(dev); | ||
640 | return ret; | 642 | return ret; |
643 | } | ||
641 | 644 | ||
642 | class_device_create(cmx_class, NULL, MKDEV(major, i), NULL, | 645 | class_device_create(cmx_class, NULL, MKDEV(major, i), NULL, |
643 | "cmx%d", i); | 646 | "cmx%d", i); |
@@ -708,12 +711,14 @@ static int __init cm4040_init(void) | |||
708 | if (major < 0) { | 711 | if (major < 0) { |
709 | printk(KERN_WARNING MODULE_NAME | 712 | printk(KERN_WARNING MODULE_NAME |
710 | ": could not get major number\n"); | 713 | ": could not get major number\n"); |
714 | class_destroy(cmx_class); | ||
711 | return major; | 715 | return major; |
712 | } | 716 | } |
713 | 717 | ||
714 | rc = pcmcia_register_driver(&reader_driver); | 718 | rc = pcmcia_register_driver(&reader_driver); |
715 | if (rc < 0) { | 719 | if (rc < 0) { |
716 | unregister_chrdev(major, DEVICE_NAME); | 720 | unregister_chrdev(major, DEVICE_NAME); |
721 | class_destroy(cmx_class); | ||
717 | return rc; | 722 | return rc; |
718 | } | 723 | } |
719 | 724 | ||