aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorJunjie Mao <junjie_mao@yeah.net>2015-01-27 21:02:44 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-25 08:40:31 -0400
commit1c34203a1496d1849ba978021b878b3447d433c8 (patch)
tree5fa2a80eb88de97fe6f373e64077f11c197052ca /drivers/base
parentbb2b40754ff4b2fffd8015ac96c45269cb54ee79 (diff)
driver core: bus: Goto appropriate labels on failure in bus_add_device
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>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/bus.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 876bae5ade33..79bc203f51ef 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -515,11 +515,11 @@ int bus_add_device(struct device *dev)
515 goto out_put; 515 goto out_put;
516 error = device_add_groups(dev, bus->dev_groups); 516 error = device_add_groups(dev, bus->dev_groups);
517 if (error) 517 if (error)
518 goto out_groups; 518 goto out_id;
519 error = sysfs_create_link(&bus->p->devices_kset->kobj, 519 error = sysfs_create_link(&bus->p->devices_kset->kobj,
520 &dev->kobj, dev_name(dev)); 520 &dev->kobj, dev_name(dev));
521 if (error) 521 if (error)
522 goto out_id; 522 goto out_groups;
523 error = sysfs_create_link(&dev->kobj, 523 error = sysfs_create_link(&dev->kobj,
524 &dev->bus->p->subsys.kobj, "subsystem"); 524 &dev->bus->p->subsys.kobj, "subsystem");
525 if (error) 525 if (error)