aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2006-10-17 02:25:59 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2006-12-04 20:09:13 -0500
commit5eb5fc97d83ee1f8fcf3490bb81ad14a99fc544c (patch)
treef09779d3be8c51f57de1e2dbf6b2446d459e6085
parent0517793fa8f98e6f30406b1811ea0312bca3a414 (diff)
[PATCH] cm4000_cs: fix return value check
The return value of class_create() need to be checked with IS_ERR(). And register_chrdev() returns errno on failure. This patch includes these fixes for cm4000_cs and cm4040_cs. Signed-off-by: Akinbou Mita <akinobu.mita@gmail.com> Signed-off-by: Harald Welte <laforge@gnumonks.org> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c6
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 50d20aafeb18..d9fdef227910 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1973,14 +1973,14 @@ static int __init cmm_init(void)
1973 printk(KERN_INFO "%s\n", version); 1973 printk(KERN_INFO "%s\n", version);
1974 1974
1975 cmm_class = class_create(THIS_MODULE, "cardman_4000"); 1975 cmm_class = class_create(THIS_MODULE, "cardman_4000");
1976 if (!cmm_class) 1976 if (IS_ERR(cmm_class))
1977 return -1; 1977 return PTR_ERR(cmm_class);
1978 1978
1979 major = register_chrdev(0, DEVICE_NAME, &cm4000_fops); 1979 major = register_chrdev(0, DEVICE_NAME, &cm4000_fops);
1980 if (major < 0) { 1980 if (major < 0) {
1981 printk(KERN_WARNING MODULE_NAME 1981 printk(KERN_WARNING MODULE_NAME
1982 ": could not get major number\n"); 1982 ": could not get major number\n");
1983 return -1; 1983 return major;
1984 } 1984 }
1985 1985
1986 rc = pcmcia_register_driver(&cm4000_driver); 1986 rc = pcmcia_register_driver(&cm4000_driver);
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 55cf4be42976..7368332c698c 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -721,14 +721,14 @@ static int __init cm4040_init(void)
721 721
722 printk(KERN_INFO "%s\n", version); 722 printk(KERN_INFO "%s\n", version);
723 cmx_class = class_create(THIS_MODULE, "cardman_4040"); 723 cmx_class = class_create(THIS_MODULE, "cardman_4040");
724 if (!cmx_class) 724 if (IS_ERR(cmx_class))
725 return -1; 725 return PTR_ERR(cmx_class);
726 726
727 major = register_chrdev(0, DEVICE_NAME, &reader_fops); 727 major = register_chrdev(0, DEVICE_NAME, &reader_fops);
728 if (major < 0) { 728 if (major < 0) {
729 printk(KERN_WARNING MODULE_NAME 729 printk(KERN_WARNING MODULE_NAME
730 ": could not get major number\n"); 730 ": could not get major number\n");
731 return -1; 731 return major;
732 } 732 }
733 733
734 rc = pcmcia_register_driver(&reader_driver); 734 rc = pcmcia_register_driver(&reader_driver);