From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Harald Welte <laforge@gnumonks.org>
Subject: [PATCH] cm4000_cs: fix return value check
Date: Tue, 17 Oct 2006 15:25:59 +0900 [thread overview]
Message-ID: <20061017062559.GB13100@localhost> (raw)
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.
Cc: Harald Welte <laforge@gnumonks.org>
Signed-off-by: Akinbou Mita <akinobu.mita@gmail.com>
drivers/char/pcmcia/cm4000_cs.c | 6 +++---
drivers/char/pcmcia/cm4040_cs.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
Index: 2.6-rc/drivers/char/pcmcia/cm4000_cs.c
===================================================================
--- 2.6-rc.orig/drivers/char/pcmcia/cm4000_cs.c
+++ 2.6-rc/drivers/char/pcmcia/cm4000_cs.c
@@ -1973,14 +1973,14 @@ static int __init cmm_init(void)
printk(KERN_INFO "%s\n", version);
cmm_class = class_create(THIS_MODULE, "cardman_4000");
- if (!cmm_class)
- return -1;
+ if (IS_ERR(cmm_class))
+ return PTR_ERR(cmm_class);
major = register_chrdev(0, DEVICE_NAME, &cm4000_fops);
if (major < 0) {
printk(KERN_WARNING MODULE_NAME
": could not get major number\n");
- return -1;
+ return major;
}
rc = pcmcia_register_driver(&cm4000_driver);
Index: 2.6-rc/drivers/char/pcmcia/cm4040_cs.c
===================================================================
--- 2.6-rc.orig/drivers/char/pcmcia/cm4040_cs.c
+++ 2.6-rc/drivers/char/pcmcia/cm4040_cs.c
@@ -721,14 +721,14 @@ static int __init cm4040_init(void)
printk(KERN_INFO "%s\n", version);
cmx_class = class_create(THIS_MODULE, "cardman_4040");
- if (!cmx_class)
- return -1;
+ if (IS_ERR(cmx_class))
+ return PTR_ERR(cmx_class);
major = register_chrdev(0, DEVICE_NAME, &reader_fops);
if (major < 0) {
printk(KERN_WARNING MODULE_NAME
": could not get major number\n");
- return -1;
+ return major;
}
rc = pcmcia_register_driver(&reader_driver);
next reply other threads:[~2006-10-17 6:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-17 6:25 Akinobu Mita [this message]
2006-10-26 2:40 ` [PATCH] cm4000_cs: fix return value check Dominik Brodowski
2006-10-26 10:25 ` Harald Welte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061017062559.GB13100@localhost \
--to=akinobu.mita@gmail.com \
--cc=laforge@gnumonks.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox