c2port: class_create() returns an ERR_PTR
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 5 Mar 2012 22:59:15 +0000 (14:59 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 5 Mar 2012 23:49:43 +0000 (15:49 -0800)
class_create() doesn't return a NULL, it only returns ERR_PTRs.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

drivers/misc/c2port/core.c

index 19fc7c1..f428d86 100644 (file)
@@ -984,9 +984,9 @@ static int __init c2port_init(void)
                " - (C) 2007 Rodolfo Giometti\n");
 
        c2port_class = class_create(THIS_MODULE, "c2port");
-       if (!c2port_class) {
+       if (IS_ERR(c2port_class)) {
                printk(KERN_ERR "c2port: failed to allocate class\n");
-               return -ENOMEM;
+               return PTR_ERR(c2port_class);
        }
        c2port_class->dev_attrs = c2port_attrs;