[3.13.y-ckt stable] Patch "driver core: bus: Goto appropriate labels on failure in bus_add_device" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Wed May 27 18:54:25 UTC 2015


This is a note to let you know that I have just added a patch titled

    driver core: bus: Goto appropriate labels on failure in bus_add_device

to the linux-3.13.y-queue branch of the 3.13.y-ckt extended stable tree 
which can be found at:

    http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-3.13.y-queue

This patch is scheduled to be released in version 3.13.11-ckt21.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.13.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

>From f7fe3687ac2a7fb346f81e86e8913320a24adedf Mon Sep 17 00:00:00 2001
From: Junjie Mao <junjie_mao at yeah.net>
Date: Wed, 28 Jan 2015 10:02:44 +0800
Subject: 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 at yeah.net>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 drivers/base/bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index a7ce942..ad0b4b5 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -504,11 +504,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)
--
1.9.1





More information about the kernel-team mailing list