diff options
author | Junjie Mao <junjie_mao@yeah.net> | 2015-01-28 10:02:44 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-05-06 21:59:21 +0200 |
commit | cc87bcf04caf19d6a6b8c996f39226477d06c26f (patch) | |
tree | 521d6a19a3a0153b702473f7883198ee80a65532 | |
parent | 3bd6baa72fa049ebe1f1d7e1c7ec819dad332d75 (diff) | |
download | lwn-cc87bcf04caf19d6a6b8c996f39226477d06c26f.tar.gz lwn-cc87bcf04caf19d6a6b8c996f39226477d06c26f.zip |
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>
-rw-r--r-- | drivers/base/bus.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 45d0fa78981c..12b39dc2ad5c 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -515,11 +515,11 @@ int bus_add_device(struct device *dev) goto out_put; error = device_add_groups(dev, bus->dev_groups); if (error) - goto out_groups; + goto out_id; error = sysfs_create_link(&bus->p->devices_kset->kobj, &dev->kobj, dev_name(dev)); if (error) - goto out_id; + goto out_groups; error = sysfs_create_link(&dev->kobj, &dev->bus->p->subsys.kobj, "subsystem"); if (error) |