From: Dan Carpenter Date: Mon, 5 Mar 2012 22:59:15 +0000 (-0800) Subject: c2port: class_create() returns an ERR_PTR X-Git-Tag: firefly_0821_release~3680^2~3425^2~9 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=22ea71d7f49c3115e3a9ced5eac109fef26d3559;p=firefly-linux-kernel-4.4.55.git c2port: class_create() returns an ERR_PTR class_create() doesn't return a NULL, it only returns ERR_PTRs. Signed-off-by: Dan Carpenter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c index 19fc7c1cb428..f428d86bfc10 100644 --- a/drivers/misc/c2port/core.c +++ b/drivers/misc/c2port/core.c @@ -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;