[dahdi-commits] tzafrir: linux/trunk r10453 - /linux/trunk/drivers/dahdi/dahdi-sysfs.c

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Wed Jan 25 16:02:41 CST 2012


Author: tzafrir
Date: Wed Jan 25 16:02:37 2012
New Revision: 10453

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10453
Log:
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 at xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>

Modified:
    linux/trunk/drivers/dahdi/dahdi-sysfs.c

Modified: linux/trunk/drivers/dahdi/dahdi-sysfs.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-sysfs.c?view=diff&rev=10453&r1=10452&r2=10453
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-sysfs.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-sysfs.c Wed Jan 25 16:02:37 2012
@@ -759,7 +759,7 @@
 		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 @@
 	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;
 	}
 




More information about the dahdi-commits mailing list