Driver core: Cleanup get_device_parent() in device_add() and device_move()
authorCornelia Huck <cornelia.huck@de.ibm.com>
Mon, 21 Jan 2008 15:09:44 +0000 (16:09 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Jan 2008 04:40:44 +0000 (20:40 -0800)
commit63b6971a0876b744e2fcf3c9df15d130501e1deb
treee5d89795dbcbc49e5685bd99a15700e58c53d95f
parent4f0146919be6bff47b5ea97252bcec0286e4dd19
Driver core: Cleanup get_device_parent() in device_add() and device_move()

Make setup_parent() void as get_device_parent() will always return
either a valid kobject or NULL.
Introduce cleanup_glue_dir() to drop reference grabbed on "glue"
directory by get_device_parent(). Use it for cleanup in device_move()
and device_add() on errors.

This should fix the refcounting problem reported in
http://marc.info/?l=linux-kernel&m=120052487909200&w=2

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Dave Young <hidave.darkstar@gmail.com>
Cc: Gabor Gombas <gombasg@sztaki.hu>
Cc: Tejun Heo <htejun@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: David Miller <davem@davemloft.net>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/core.c