driver core: bus: Goto appropriate labels on failure in bus_add_device
authorJunjie Mao <junjie_mao@yeah.net>
Wed, 28 Jan 2015 02:02:44 +0000 (10:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 May 2015 20:02:05 +0000 (22:02 +0200)
commitfb2eb817150444c37f17361b72623d3a39d093ef
treed113100885528d33e251cc582a5e4e319f415fb5
parent9e862ee60a60dde9a812ee90dc17dd613b335fed
driver core: bus: Goto appropriate labels on failure in bus_add_device

commit 1c34203a1496d1849ba978021b878b3447d433c8 upstream.

It is not necessary to call device_remove_groups() when device_add_groups()
fails.

The group added by device_add_groups() should be removed if sysfs_create_link()
fails.

Fixes: fa6fdb33b486 ("driver core: bus_type: add dev_groups")
Signed-off-by: Junjie Mao <junjie_mao@yeah.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/bus.c