X-Git-Url: http://git.onelab.eu/?p=linux-2.6.git;a=blobdiff_plain;f=drivers%2Fs390%2Fchar%2Ftape_class.c;h=56b87618b100c1d33b8829d3f9bd184f7c80f7b6;hp=a5c68e60fcf4e64a3285e5941699e21c924db02e;hb=16c70f8c1b54b61c3b951b6fb220df250fe09b32;hpb=4e76c8a9fa413ccc09d3f7f664183dcce3555d57 diff --git a/drivers/s390/char/tape_class.c b/drivers/s390/char/tape_class.c index a5c68e60f..56b87618b 100644 --- a/drivers/s390/char/tape_class.c +++ b/drivers/s390/char/tape_class.c @@ -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);