aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/i2o/device.c19
-rw-r--r--drivers/message/i2o/i2o_scsi.c12
2 files changed, 21 insertions, 10 deletions
diff --git a/drivers/message/i2o/device.c b/drivers/message/i2o/device.c
index ee183053fa23..55757af4e3b2 100644
--- a/drivers/message/i2o/device.c
+++ b/drivers/message/i2o/device.c
@@ -214,18 +214,17 @@ static struct i2o_device *i2o_device_alloc(void)
214 * Allocate a new I2O device and initialize it with the LCT entry. The 214 * Allocate a new I2O device and initialize it with the LCT entry. The
215 * device is appended to the device list of the controller. 215 * device is appended to the device list of the controller.
216 * 216 *
217 * Returns a pointer to the I2O device on success or negative error code 217 * Returns zero on success, or a -ve errno.
218 * on failure.
219 */ 218 */
220static struct i2o_device *i2o_device_add(struct i2o_controller *c, 219static int i2o_device_add(struct i2o_controller *c, i2o_lct_entry *entry)
221 i2o_lct_entry * entry)
222{ 220{
223 struct i2o_device *i2o_dev, *tmp; 221 struct i2o_device *i2o_dev, *tmp;
222 int rc;
224 223
225 i2o_dev = i2o_device_alloc(); 224 i2o_dev = i2o_device_alloc();
226 if (IS_ERR(i2o_dev)) { 225 if (IS_ERR(i2o_dev)) {
227 printk(KERN_ERR "i2o: unable to allocate i2o device\n"); 226 printk(KERN_ERR "i2o: unable to allocate i2o device\n");
228 return i2o_dev; 227 return PTR_ERR(i2o_dev);
229 } 228 }
230 229
231 i2o_dev->lct_data = *entry; 230 i2o_dev->lct_data = *entry;
@@ -236,7 +235,9 @@ static struct i2o_device *i2o_device_add(struct i2o_controller *c,
236 i2o_dev->iop = c; 235 i2o_dev->iop = c;
237 i2o_dev->device.parent = &c->device; 236 i2o_dev->device.parent = &c->device;
238 237
239 device_register(&i2o_dev->device); 238 rc = device_register(&i2o_dev->device);
239 if (rc)
240 goto err;
240 241
241 list_add_tail(&i2o_dev->list, &c->devices); 242 list_add_tail(&i2o_dev->list, &c->devices);
242 243
@@ -270,7 +271,11 @@ static struct i2o_device *i2o_device_add(struct i2o_controller *c,
270 271
271 pr_debug("i2o: device %s added\n", i2o_dev->device.bus_id); 272 pr_debug("i2o: device %s added\n", i2o_dev->device.bus_id);
272 273
273 return i2o_dev; 274 return 0;
275
276err:
277 kfree(i2o_dev);
278 return rc;
274} 279}
275 280
276/** 281/**
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c
index 6ebf38213f9f..d5f93b12b6f1 100644
--- a/drivers/message/i2o/i2o_scsi.c
+++ b/drivers/message/i2o/i2o_scsi.c
@@ -220,7 +220,7 @@ static int i2o_scsi_probe(struct device *dev)
220 u32 id = -1; 220 u32 id = -1;
221 u64 lun = -1; 221 u64 lun = -1;
222 int channel = -1; 222 int channel = -1;
223 int i; 223 int i, rc;
224 224
225 i2o_shost = i2o_scsi_get_host(c); 225 i2o_shost = i2o_scsi_get_host(c);
226 if (!i2o_shost) 226 if (!i2o_shost)
@@ -304,14 +304,20 @@ static int i2o_scsi_probe(struct device *dev)
304 return PTR_ERR(scsi_dev); 304 return PTR_ERR(scsi_dev);
305 } 305 }
306 306
307 sysfs_create_link(&i2o_dev->device.kobj, &scsi_dev->sdev_gendev.kobj, 307 rc = sysfs_create_link(&i2o_dev->device.kobj,
308 "scsi"); 308 &scsi_dev->sdev_gendev.kobj, "scsi");
309 if (rc)
310 goto err;
309 311
310 osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %ld\n", 312 osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %ld\n",
311 i2o_dev->lct_data.tid, channel, le32_to_cpu(id), 313 i2o_dev->lct_data.tid, channel, le32_to_cpu(id),
312 (long unsigned int)le64_to_cpu(lun)); 314 (long unsigned int)le64_to_cpu(lun));
313 315
314 return 0; 316 return 0;
317
318err:
319 scsi_remove_device(scsi_dev);
320 return rc;
315}; 321};
316 322
317static const char *i2o_scsi_info(struct Scsi_Host *SChost) 323static const char *i2o_scsi_info(struct Scsi_Host *SChost)