]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/s390/char/tape_class.c
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[linux-2.6-omap-h63xx.git] / drivers / s390 / char / tape_class.c
index a5c68e60fcf4e64a3285e5941699e21c924db02e..2e0d29730b67590639f8e0dba84b48ae90ebd5b5 100644 (file)
@@ -36,7 +36,7 @@ static struct class *tape_class;
 struct tape_class_device *register_tape_dev(
        struct device *         device,
        dev_t                   dev,
-       struct file_operations *fops,
+       const struct file_operations *fops,
        char *                  device_name,
        char *                  mode_name)
 {
@@ -76,14 +76,22 @@ struct tape_class_device *register_tape_dev(
                                device,
                                "%s", tcd->device_name
                        );
-       sysfs_create_link(
+       rc = IS_ERR(tcd->class_device) ? PTR_ERR(tcd->class_device) : 0;
+       if (rc)
+               goto fail_with_cdev;
+       rc = sysfs_create_link(
                &device->kobj,
                &tcd->class_device->kobj,
                tcd->mode_name
        );
+       if (rc)
+               goto fail_with_class_device;
 
        return tcd;
 
+fail_with_class_device:
+       class_device_destroy(tape_class, tcd->char_device->dev);
+
 fail_with_cdev:
        cdev_del(tcd->char_device);