aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2007-05-09 05:33:31 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-09 15:30:49 -0400
commit54493c10069741a02cd34c2b44a6bfdb85e7de6a (patch)
tree21c3d853bb7af8b7f5b1f77ebdab0e8922c3e49c /drivers/char
parent8813d1c00ca923c1683da625ff85959be1db9a49 (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')
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c9
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c7
2 files changed, 13 insertions, 3 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index e91b43a014b0..8cbc64fe0feb 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1881,8 +1881,11 @@ static int cm4000_probe(struct pcmcia_device *link)
1881 init_waitqueue_head(&dev->readq); 1881 init_waitqueue_head(&dev->readq);
1882 1882
1883 ret = cm4000_config(link, i); 1883 ret = cm4000_config(link, i);
1884 if (ret) 1884 if (ret) {
1885 dev_table[i] = NULL;
1886 kfree(dev);
1885 return ret; 1887 return ret;
1888 }
1886 1889
1887 class_device_create(cmm_class, NULL, MKDEV(major, i), NULL, 1890 class_device_create(cmm_class, NULL, MKDEV(major, i), NULL,
1888 "cmm%d", i); 1891 "cmm%d", i);
@@ -1907,7 +1910,7 @@ static void cm4000_detach(struct pcmcia_device *link)
1907 cm4000_release(link); 1910 cm4000_release(link);
1908 1911
1909 dev_table[devno] = NULL; 1912 dev_table[devno] = NULL;
1910 kfree(dev); 1913 kfree(dev);
1911 1914
1912 class_device_destroy(cmm_class, MKDEV(major, devno)); 1915 class_device_destroy(cmm_class, MKDEV(major, devno));
1913 1916
@@ -1956,12 +1959,14 @@ static int __init cmm_init(void)
1956 if (major < 0) { 1959 if (major < 0) {
1957 printk(KERN_WARNING MODULE_NAME 1960 printk(KERN_WARNING MODULE_NAME
1958 ": could not get major number\n"); 1961 ": could not get major number\n");
1962 class_destroy(cmm_class);
1959 return major; 1963 return major;
1960 } 1964 }
1961 1965
1962 rc = pcmcia_register_driver(&cm4000_driver); 1966 rc = pcmcia_register_driver(&cm4000_driver);
1963 if (rc < 0) { 1967 if (rc < 0) {
1964 unregister_chrdev(major, DEVICE_NAME); 1968 unregister_chrdev(major, DEVICE_NAME);
1969 class_destroy(cmm_class);
1965 return rc; 1970 return rc;
1966 } 1971 }
1967 1972
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