aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/hosts.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2006-10-10 15:19:21 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2006-12-07 15:29:57 -0500
commitc1c9c7cd9f33ad6ff4407638060fe2730560bd56 (patch)
tree9c8f6eb326ccdba907a64c99f1b1f75604b0ff85 /drivers/ieee1394/hosts.c
parent1ed891c6d49e97ebd3305d8c6213246a14f0800f (diff)
ieee1394: handle sysfs errors
Handle driver core errors with as much care as appropriate. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/ieee1394/hosts.c')
-rw-r--r--drivers/ieee1394/hosts.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c
index fbf17cfe79b0..ee82a5320bf7 100644
--- a/drivers/ieee1394/hosts.c
+++ b/drivers/ieee1394/hosts.c
@@ -131,10 +131,8 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
131 return NULL; 131 return NULL;
132 132
133 h->csr.rom = csr1212_create_csr(&csr_bus_ops, CSR_BUS_INFO_SIZE, h); 133 h->csr.rom = csr1212_create_csr(&csr_bus_ops, CSR_BUS_INFO_SIZE, h);
134 if (!h->csr.rom) { 134 if (!h->csr.rom)
135 kfree(h); 135 goto fail;
136 return NULL;
137 }
138 136
139 h->hostdata = h + 1; 137 h->hostdata = h + 1;
140 h->driver = drv; 138 h->driver = drv;
@@ -173,11 +171,19 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
173 h->class_dev.class = &hpsb_host_class; 171 h->class_dev.class = &hpsb_host_class;
174 snprintf(h->class_dev.class_id, BUS_ID_SIZE, "fw-host%d", h->id); 172 snprintf(h->class_dev.class_id, BUS_ID_SIZE, "fw-host%d", h->id);
175 173
176 device_register(&h->device); 174 if (device_register(&h->device))
177 class_device_register(&h->class_dev); 175 goto fail;
176 if (class_device_register(&h->class_dev)) {
177 device_unregister(&h->device);
178 goto fail;
179 }
178 get_device(&h->device); 180 get_device(&h->device);
179 181
180 return h; 182 return h;
183
184fail:
185 kfree(h);
186 return NULL;
181} 187}
182 188
183int hpsb_add_host(struct hpsb_host *host) 189int hpsb_add_host(struct hpsb_host *host)