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

From: Vasiliy Kulikov
Date: Sun Sep 19 2010 - 08:56:59 EST


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

Signed-off-by: Vasiliy Kulikov <segooon@xxxxxxxxx>
---
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

--
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/