[PATCH 05/14] message: i2o: fix device_register() error handling

From: Vasiliy Kulikov
Date: Sun Sep 19 2010 - 08:57:15 EST


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

Signed-off-by: Vasiliy Kulikov <segooon@xxxxxxxxx>
---
compile tested.

drivers/message/i2o/device.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/message/i2o/device.c b/drivers/message/i2o/device.c
index 0ee4264..3ac8ec3 100644
--- a/drivers/message/i2o/device.c
+++ b/drivers/message/i2o/device.c
@@ -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);

--
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/