diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2012-01-25 22:02:37 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2012-01-25 22:02:37 +0000 |
commit | c15a85433c611d0d57906a0a3efd50394c57f419 (patch) | |
tree | 52b9a207e3cceac55b404a9d8fdfc37568b008fa /drivers | |
parent | 7205376d088d91b6680964e05c6ab20dbbc554f5 (diff) |
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 <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10453 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dahdi/dahdi-sysfs.c | 6 |
1 files 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; } |