]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/atm/atm_sysfs.c
[DECNET] address: Convert to new netlink interface
[linux-2.6-omap-h63xx.git] / net / atm / atm_sysfs.c
index 5df4b9a068bb2e103315b1e9858c764aea5b06d8..62f6ed1f2f98c9c5c25d70759f87d60e3e4f699d 100644 (file)
@@ -1,6 +1,5 @@
 /* ATM driver model support. */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/kobject.h>
@@ -142,7 +141,7 @@ static struct class atm_class = {
 int atm_register_sysfs(struct atm_dev *adev)
 {
        struct class_device *cdev = &adev->class_dev;
-       int i, err;
+       int i, j, err;
 
        cdev->class = &atm_class;
        class_set_devdata(cdev, adev);
@@ -152,10 +151,19 @@ int atm_register_sysfs(struct atm_dev *adev)
        if (err < 0)
                return err;
 
-       for (i = 0; atm_attrs[i]; i++)
-               class_device_create_file(cdev, atm_attrs[i]);
+       for (i = 0; atm_attrs[i]; i++) {
+               err = class_device_create_file(cdev, atm_attrs[i]);
+               if (err)
+                       goto err_out;
+       }
 
        return 0;
+
+err_out:
+       for (j = 0; j < i; j++)
+               class_device_remove_file(cdev, atm_attrs[j]);
+       class_device_del(cdev);
+       return err;
 }
 
 void atm_unregister_sysfs(struct atm_dev *adev)