Skip to contentSkip to conversation

message: i2o: fix device_register() error handling

PATCH Applied Vasiliy Kulikov 1 participant 1 message Sep 19, 2010 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 5/14 message: i2o: fix device_register() error handling

If device_register() fails then call put_device(). See comment to device_register.

---
compile tested.

 drivers/message/i2o/device.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/message/i2o/device.c +3 -1
index 0ee4264..3ac8ec3 100644
@@ -234,8 +234,10 @@ static int i2o_device_add(struct i2o_controller *c, i2o_lct_entry *entry)
 	i2o_dev->device.parent = &c->device;
 
 	rc = device_register(&i2o_dev->device);
-	if (rc)
+	if (rc) {
+		put_device(&i2o_dev->device);
 		goto err;
+	}
 
 	list_add_tail(&i2o_dev->list, &c->devices);
 
Signature · 1 line
1.7.0.4