Skip to content

Commit d08282c

Browse files
Junjie Maosashalevin
authored andcommitted
driver core: bus: Goto appropriate labels on failure in bus_add_device
[ Upstream commit 1c34203 ] 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: fa6fdb3 ("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>
1 parent ce7c6bb commit d08282c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/base/bus.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,11 +515,11 @@ int bus_add_device(struct device *dev)
515515
goto out_put;
516516
error = device_add_groups(dev, bus->dev_groups);
517517
if (error)
518-
goto out_groups;
518+
goto out_id;
519519
error = sysfs_create_link(&bus->p->devices_kset->kobj,
520520
&dev->kobj, dev_name(dev));
521521
if (error)
522-
goto out_id;
522+
goto out_groups;
523523
error = sysfs_create_link(&dev->kobj,
524524
&dev->bus->p->subsys.kobj, "subsystem");
525525
if (error)

0 commit comments

Comments
 (0)