diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2007-05-09 11:33:31 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 21:30:49 +0200 |
commit | 54493c10069741a02cd34c2b44a6bfdb85e7de6a (patch) | |
tree | 21c3d853bb7af8b7f5b1f77ebdab0e8922c3e49c /drivers/char/pcmcia/cm4000_cs.c | |
parent | mca: add integrated device bus matching (diff) | |
download | linux-54493c10069741a02cd34c2b44a6bfdb85e7de6a.tar.xz linux-54493c10069741a02cd34c2b44a6bfdb85e7de6a.zip |
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/cm4000_cs.c')
-rw-r--r-- | drivers/char/pcmcia/cm4000_cs.c | 9 |
1 files changed, 7 insertions, 2 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) init_waitqueue_head(&dev->readq); ret = cm4000_config(link, i); - if (ret) + if (ret) { + dev_table[i] = NULL; + kfree(dev); return ret; + } class_device_create(cmm_class, NULL, MKDEV(major, i), NULL, "cmm%d", i); @@ -1907,7 +1910,7 @@ static void cm4000_detach(struct pcmcia_device *link) cm4000_release(link); dev_table[devno] = NULL; - kfree(dev); + kfree(dev); class_device_destroy(cmm_class, MKDEV(major, devno)); @@ -1956,12 +1959,14 @@ static int __init cmm_init(void) if (major < 0) { printk(KERN_WARNING MODULE_NAME ": could not get major number\n"); + class_destroy(cmm_class); return major; } rc = pcmcia_register_driver(&cm4000_driver); if (rc < 0) { unregister_chrdev(major, DEVICE_NAME); + class_destroy(cmm_class); return rc; } |