From c15a85433c611d0d57906a0a3efd50394c57f419 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Wed, 25 Jan 2012 22:02:37 +0000 Subject: fix class_create() return value test In case of error class_create check IS_ERR()/PTR_ERR() and not for NULL. Signed-off-by: Oron Peled Acked-by: Tzafrir Cohen git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10453 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-sysfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dahdi/dahdi-sysfs.c b/drivers/dahdi/dahdi-sysfs.c index 3b9784d..055ccd9 100644 --- a/drivers/dahdi/dahdi-sysfs.c +++ b/drivers/dahdi/dahdi-sysfs.c @@ -759,7 +759,7 @@ void dahdi_sysfs_exit(void) DEL_DAHDI_DEV(DAHDI_CTL); dummy_dev.ctl = 0; } - if (dahdi_class) { + if (dahdi_class && !IS_ERR(dahdi_class)) { dahdi_dbg(DEVICES, "Destroying DAHDI class:\n"); class_destroy(dahdi_class); dahdi_class = NULL; @@ -850,8 +850,8 @@ int __init dahdi_sysfs_init(const struct file_operations *dahdi_fops) module_printk(KERN_INFO, "Version: %s\n", dahdi_version); dahdi_class = class_create(THIS_MODULE, "dahdi"); - if (!dahdi_class) { - res = -EEXIST; + if (IS_ERR(dahdi_class)) { + res = PTR_ERR(dahdi_class); goto cleanup; } -- cgit v1.2.3