* [PATCH] cm4000_cs: fix return value check
@ 2006-10-17 6:25 Akinobu Mita
2006-10-26 2:40 ` Dominik Brodowski
0 siblings, 1 reply; 3+ messages in thread
From: Akinobu Mita @ 2006-10-17 6:25 UTC (permalink / raw)
To: linux-kernel; +Cc: Harald Welte
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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cm4000_cs: fix return value check
2006-10-17 6:25 [PATCH] cm4000_cs: fix return value check Akinobu Mita
@ 2006-10-26 2:40 ` Dominik Brodowski
2006-10-26 10:25 ` Harald Welte
0 siblings, 1 reply; 3+ messages in thread
From: Dominik Brodowski @ 2006-10-26 2:40 UTC (permalink / raw)
To: Akinobu Mita, linux-kernel, Harald Welte
Hi,
On Tue, Oct 17, 2006 at 03:25:59PM +0900, Akinobu Mita wrote:
> 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>
Temporarily applied to pcmica-2.6.git, thanks. Harald, do you ACK?
Thanks,
Dominik
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cm4000_cs: fix return value check
2006-10-26 2:40 ` Dominik Brodowski
@ 2006-10-26 10:25 ` Harald Welte
0 siblings, 0 replies; 3+ messages in thread
From: Harald Welte @ 2006-10-26 10:25 UTC (permalink / raw)
To: Dominik Brodowski, Akinobu Mita, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 911 bytes --]
On Wed, Oct 25, 2006 at 10:40:04PM -0400, Dominik Brodowski wrote:
> On Tue, Oct 17, 2006 at 03:25:59PM +0900, Akinobu Mita wrote:
> > 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>
>
> Temporarily applied to pcmica-2.6.git, thanks. Harald, do you ACK?
yes, sorry. I've been too busy and the mail slipped through...
The patch is obviously fine. Thanks!
Signed-off-by: Harald Welte <laforge@gnumonks.org>
--
- Harald Welte <laforge@gnumonks.org> http://gnumonks.org/
============================================================================
We all know Linux is great...it does infinite loops in 5 seconds. -- Linus
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-10-26 10:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-17 6:25 [PATCH] cm4000_cs: fix return value check Akinobu Mita
2006-10-26 2:40 ` Dominik Brodowski
2006-10-26 10:25 ` Harald Welte
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox