Corrected incorrect check of class_device_create() return code validity.
authorppisa <ppisa>
Sat, 18 Feb 2006 01:29:12 +0000 (01:29 +0000)
committerppisa <ppisa>
Sat, 18 Feb 2006 01:29:12 +0000 (01:29 +0000)
Noticed by Sergei Sharonov.

lincan/src/main.c

index c4fb22a..92d7966 100644 (file)
@@ -313,10 +313,11 @@ int init_module(void)
                      #else /* >= 2.6.15 */
                        this_dev=class_device_create(can_class, NULL, MKDEV(major, dev_minor), NULL,  "can%d", dev_minor);
                      #endif /* >= 2.6.15 */
-                       if(!this_dev){
+                       if(IS_ERR(this_dev)){
                                CANMSG("problem to create device \"can%d\" in the class \"can\"\n", dev_minor);
                        }else{
-                               this_dev->class_data=objects_p[i];
+                               /*this_dev->class_data=objects_p[i];*/
+                               class_set_devdata(this_dev,objects_p[i]);
                        }
                      #ifdef CONFIG_DEVFS_FS
                        devfs_mk_cdev(MKDEV(major, dev_minor), S_IFCHR | S_IRUGO | S_IWUGO, "can%d", dev_minor);