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
This commit is contained in:
Oron Peled
2012-01-25 22:02:37 +00:00
committed by Tzafrir Cohen
parent 3cf9003a26
commit 8e22110bfd

View File

@@ -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;
}