[PATCH 07/14] pcmcia: ds: fix device_register() error handling

Vasiliy Kulikov
2010-09-19T12:56:57Z

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

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

drivers/pcmcia/ds.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 100c441..b56f5a6 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -582,10 +582,12 @@ static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s,
pcmcia_device_query(p_dev);

if (device_register(&p_dev->dev))
- goto err_unreg;
+ goto err_put_device;

return p_dev;

+ err_put_device:
+ put_device(&p_dev->dev);
err_unreg:
mutex_lock(&s->ops_mutex);
list_del(&p_dev->socket_device_list);
--
1.7.0.4