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)
committerSasha Levin <sasha.levin@oracle.com>
Sun, 17 May 2015 23:12:29 +0000 (19:12 -0400)
commitd08282c148c574d5ef8d81f657a6e64d49da1d88
tree37dc19b08c9c62ae3ff40f88e61365213dd718e5
parentce7c6bb45f81d96764f1674bcba70c98c969e6b8
driver core: bus: Goto appropriate labels on failure in bus_add_device

[ Upstream commit 1c34203a1496d1849ba978021b878b3447d433c8 ]

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>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/base/bus.c