diff options
Diffstat (limited to 'drivers/dio')
-rw-r--r-- | drivers/dio/dio-sysfs.c | 16 | ||||
-rw-r--r-- | drivers/dio/dio.c | 18 |
2 files changed, 25 insertions, 9 deletions
diff --git a/drivers/dio/dio-sysfs.c b/drivers/dio/dio-sysfs.c index f46463038847..91d5f4da8769 100644 --- a/drivers/dio/dio-sysfs.c +++ b/drivers/dio/dio-sysfs.c | |||
@@ -63,15 +63,19 @@ static ssize_t dio_show_resource(struct device *dev, struct device_attribute *at | |||
63 | } | 63 | } |
64 | static DEVICE_ATTR(resource, S_IRUGO, dio_show_resource, NULL); | 64 | static DEVICE_ATTR(resource, S_IRUGO, dio_show_resource, NULL); |
65 | 65 | ||
66 | void dio_create_sysfs_dev_files(struct dio_dev *d) | 66 | int dio_create_sysfs_dev_files(struct dio_dev *d) |
67 | { | 67 | { |
68 | struct device *dev = &d->dev; | 68 | struct device *dev = &d->dev; |
69 | int error; | ||
69 | 70 | ||
70 | /* current configuration's attributes */ | 71 | /* current configuration's attributes */ |
71 | device_create_file(dev, &dev_attr_id); | 72 | if ((error = device_create_file(dev, &dev_attr_id)) || |
72 | device_create_file(dev, &dev_attr_ipl); | 73 | (error = device_create_file(dev, &dev_attr_ipl)) || |
73 | device_create_file(dev, &dev_attr_secid); | 74 | (error = device_create_file(dev, &dev_attr_secid)) || |
74 | device_create_file(dev, &dev_attr_name); | 75 | (error = device_create_file(dev, &dev_attr_name)) || |
75 | device_create_file(dev, &dev_attr_resource); | 76 | (error = device_create_file(dev, &dev_attr_resource))) |
77 | return error; | ||
78 | |||
79 | return 0; | ||
76 | } | 80 | } |
77 | 81 | ||
diff --git a/drivers/dio/dio.c b/drivers/dio/dio.c index 07f274f853d9..10c3c498358c 100644 --- a/drivers/dio/dio.c +++ b/drivers/dio/dio.c | |||
@@ -173,6 +173,7 @@ static int __init dio_init(void) | |||
173 | mm_segment_t fs; | 173 | mm_segment_t fs; |
174 | int i; | 174 | int i; |
175 | struct dio_dev *dev; | 175 | struct dio_dev *dev; |
176 | int error; | ||
176 | 177 | ||
177 | if (!MACH_IS_HP300) | 178 | if (!MACH_IS_HP300) |
178 | return 0; | 179 | return 0; |
@@ -182,7 +183,11 @@ static int __init dio_init(void) | |||
182 | /* Initialize the DIO bus */ | 183 | /* Initialize the DIO bus */ |
183 | INIT_LIST_HEAD(&dio_bus.devices); | 184 | INIT_LIST_HEAD(&dio_bus.devices); |
184 | strcpy(dio_bus.dev.bus_id, "dio"); | 185 | strcpy(dio_bus.dev.bus_id, "dio"); |
185 | device_register(&dio_bus.dev); | 186 | error = device_register(&dio_bus.dev); |
187 | if (error) { | ||
188 | pr_err("DIO: Error registering dio_bus\n"); | ||
189 | return error; | ||
190 | } | ||
186 | 191 | ||
187 | /* Request all resources */ | 192 | /* Request all resources */ |
188 | dio_bus.num_resources = (hp300_model == HP_320 ? 1 : 2); | 193 | dio_bus.num_resources = (hp300_model == HP_320 ? 1 : 2); |
@@ -252,8 +257,15 @@ static int __init dio_init(void) | |||
252 | 257 | ||
253 | if (scode >= DIOII_SCBASE) | 258 | if (scode >= DIOII_SCBASE) |
254 | iounmap(va); | 259 | iounmap(va); |
255 | device_register(&dev->dev); | 260 | error = device_register(&dev->dev); |
256 | dio_create_sysfs_dev_files(dev); | 261 | if (error) { |
262 | pr_err("DIO: Error registering device %s\n", | ||
263 | dev->name); | ||
264 | continue; | ||
265 | } | ||
266 | error = dio_create_sysfs_dev_files(dev); | ||
267 | if (error) | ||
268 | dev_err(&dev->dev, "Error creating sysfs files\n"); | ||
257 | } | 269 | } |
258 | return 0; | 270 | return 0; |
259 | } | 271 | } |