diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2006-07-18 07:46:58 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-07-18 07:46:58 -0400 |
commit | d7cf0d57ef9e07cf0f65c58c19a8e7c4a9db72b5 (patch) | |
tree | 2715e0badd8e5fbf6b787f8ff3120c2a87551688 /drivers/s390/char | |
parent | dc8f5d21dd6bdd94e5c5bf9bbcc616d00f0cc839 (diff) |
[S390] sysfs_create_xxx return values.
Take return values of sysfs_create_group & friends into account.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/char')
-rw-r--r-- | drivers/s390/char/raw3270.c | 52 | ||||
-rw-r--r-- | drivers/s390/char/tape_class.c | 10 | ||||
-rw-r--r-- | drivers/s390/char/tape_core.c | 18 |
3 files changed, 55 insertions, 25 deletions
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index 95e285b2e25c..7a84014f2037 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
@@ -1106,10 +1106,10 @@ raw3270_delete_device(struct raw3270 *rp) | |||
1106 | 1106 | ||
1107 | /* Remove from device chain. */ | 1107 | /* Remove from device chain. */ |
1108 | mutex_lock(&raw3270_mutex); | 1108 | mutex_lock(&raw3270_mutex); |
1109 | if (rp->clttydev) | 1109 | if (rp->clttydev && !IS_ERR(rp->clttydev)) |
1110 | class_device_destroy(class3270, | 1110 | class_device_destroy(class3270, |
1111 | MKDEV(IBM_TTY3270_MAJOR, rp->minor)); | 1111 | MKDEV(IBM_TTY3270_MAJOR, rp->minor)); |
1112 | if (rp->cltubdev) | 1112 | if (rp->cltubdev && !IS_ERR(rp->cltubdev)) |
1113 | class_device_destroy(class3270, | 1113 | class_device_destroy(class3270, |
1114 | MKDEV(IBM_FS3270_MAJOR, rp->minor)); | 1114 | MKDEV(IBM_FS3270_MAJOR, rp->minor)); |
1115 | list_del_init(&rp->list); | 1115 | list_del_init(&rp->list); |
@@ -1173,21 +1173,37 @@ static struct attribute_group raw3270_attr_group = { | |||
1173 | .attrs = raw3270_attrs, | 1173 | .attrs = raw3270_attrs, |
1174 | }; | 1174 | }; |
1175 | 1175 | ||
1176 | static void | 1176 | static int raw3270_create_attributes(struct raw3270 *rp) |
1177 | raw3270_create_attributes(struct raw3270 *rp) | ||
1178 | { | 1177 | { |
1179 | //FIXME: check return code | 1178 | int rc; |
1180 | sysfs_create_group(&rp->cdev->dev.kobj, &raw3270_attr_group); | 1179 | |
1181 | rp->clttydev = | 1180 | rc = sysfs_create_group(&rp->cdev->dev.kobj, &raw3270_attr_group); |
1182 | class_device_create(class3270, NULL, | 1181 | if (rc) |
1183 | MKDEV(IBM_TTY3270_MAJOR, rp->minor), | 1182 | goto out; |
1184 | &rp->cdev->dev, "tty%s", | 1183 | |
1185 | rp->cdev->dev.bus_id); | 1184 | rp->clttydev = class_device_create(class3270, NULL, |
1186 | rp->cltubdev = | 1185 | MKDEV(IBM_TTY3270_MAJOR, rp->minor), |
1187 | class_device_create(class3270, NULL, | 1186 | &rp->cdev->dev, "tty%s", |
1188 | MKDEV(IBM_FS3270_MAJOR, rp->minor), | 1187 | rp->cdev->dev.bus_id); |
1189 | &rp->cdev->dev, "tub%s", | 1188 | if (IS_ERR(rp->clttydev)) { |
1190 | rp->cdev->dev.bus_id); | 1189 | rc = PTR_ERR(rp->clttydev); |
1190 | goto out_ttydev; | ||
1191 | } | ||
1192 | |||
1193 | rp->cltubdev = class_device_create(class3270, NULL, | ||
1194 | MKDEV(IBM_FS3270_MAJOR, rp->minor), | ||
1195 | &rp->cdev->dev, "tub%s", | ||
1196 | rp->cdev->dev.bus_id); | ||
1197 | if (!IS_ERR(rp->cltubdev)) | ||
1198 | goto out; | ||
1199 | |||
1200 | rc = PTR_ERR(rp->cltubdev); | ||
1201 | class_device_destroy(class3270, MKDEV(IBM_TTY3270_MAJOR, rp->minor)); | ||
1202 | |||
1203 | out_ttydev: | ||
1204 | sysfs_remove_group(&rp->cdev->dev.kobj, &raw3270_attr_group); | ||
1205 | out: | ||
1206 | return rc; | ||
1191 | } | 1207 | } |
1192 | 1208 | ||
1193 | /* | 1209 | /* |
@@ -1255,7 +1271,9 @@ raw3270_set_online (struct ccw_device *cdev) | |||
1255 | rc = raw3270_reset_device(rp); | 1271 | rc = raw3270_reset_device(rp); |
1256 | if (rc) | 1272 | if (rc) |
1257 | goto failure; | 1273 | goto failure; |
1258 | raw3270_create_attributes(rp); | 1274 | rc = raw3270_create_attributes(rp); |
1275 | if (rc) | ||
1276 | goto failure; | ||
1259 | set_bit(RAW3270_FLAGS_READY, &rp->flags); | 1277 | set_bit(RAW3270_FLAGS_READY, &rp->flags); |
1260 | mutex_lock(&raw3270_mutex); | 1278 | mutex_lock(&raw3270_mutex); |
1261 | list_for_each_entry(np, &raw3270_notifier, list) | 1279 | list_for_each_entry(np, &raw3270_notifier, list) |
diff --git a/drivers/s390/char/tape_class.c b/drivers/s390/char/tape_class.c index a5c68e60fcf4..643b6d078563 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( | |||
76 | device, | 76 | device, |
77 | "%s", tcd->device_name | 77 | "%s", tcd->device_name |
78 | ); | 78 | ); |
79 | sysfs_create_link( | 79 | rc = PTR_ERR(tcd->class_device); |
80 | if (rc) | ||
81 | goto fail_with_cdev; | ||
82 | rc = sysfs_create_link( | ||
80 | &device->kobj, | 83 | &device->kobj, |
81 | &tcd->class_device->kobj, | 84 | &tcd->class_device->kobj, |
82 | tcd->mode_name | 85 | tcd->mode_name |
83 | ); | 86 | ); |
87 | if (rc) | ||
88 | goto fail_with_class_device; | ||
84 | 89 | ||
85 | return tcd; | 90 | return tcd; |
86 | 91 | ||
92 | fail_with_class_device: | ||
93 | class_device_destroy(tape_class, tcd->char_device->dev); | ||
94 | |||
87 | fail_with_cdev: | 95 | fail_with_cdev: |
88 | cdev_del(tcd->char_device); | 96 | cdev_del(tcd->char_device); |
89 | 97 | ||
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c index 122b4d8965c3..2826aed91043 100644 --- a/drivers/s390/char/tape_core.c +++ b/drivers/s390/char/tape_core.c | |||
@@ -543,20 +543,24 @@ int | |||
543 | tape_generic_probe(struct ccw_device *cdev) | 543 | tape_generic_probe(struct ccw_device *cdev) |
544 | { | 544 | { |
545 | struct tape_device *device; | 545 | struct tape_device *device; |
546 | int ret; | ||
546 | 547 | ||
547 | device = tape_alloc_device(); | 548 | device = tape_alloc_device(); |
548 | if (IS_ERR(device)) | 549 | if (IS_ERR(device)) |
549 | return -ENODEV; | 550 | return -ENODEV; |
550 | PRINT_INFO("tape device %s found\n", cdev->dev.bus_id); | 551 | ccw_device_set_options(cdev, CCWDEV_DO_PATHGROUP); |
552 | ret = sysfs_create_group(&cdev->dev.kobj, &tape_attr_group); | ||
553 | if (ret) { | ||
554 | tape_put_device(device); | ||
555 | PRINT_ERR("probe failed for tape device %s\n", cdev->dev.bus_id); | ||
556 | return ret; | ||
557 | } | ||
551 | cdev->dev.driver_data = device; | 558 | cdev->dev.driver_data = device; |
559 | cdev->handler = __tape_do_irq; | ||
552 | device->cdev = cdev; | 560 | device->cdev = cdev; |
553 | device->cdev_id = busid_to_int(cdev->dev.bus_id); | 561 | device->cdev_id = busid_to_int(cdev->dev.bus_id); |
554 | cdev->handler = __tape_do_irq; | 562 | PRINT_INFO("tape device %s found\n", cdev->dev.bus_id); |
555 | 563 | return ret; | |
556 | ccw_device_set_options(cdev, CCWDEV_DO_PATHGROUP); | ||
557 | sysfs_create_group(&cdev->dev.kobj, &tape_attr_group); | ||
558 | |||
559 | return 0; | ||
560 | } | 564 | } |
561 | 565 | ||
562 | static inline void | 566 | static inline void |