Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2993456AbbEPIqv (ORCPT ); Sat, 16 May 2015 04:46:51 -0400 Received: from bband-dyn183.178-41-215.t-com.sk ([178.41.215.183]:22448 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1946060AbbEPIE4 (ORCPT ); Sat, 16 May 2015 04:04:56 -0400 From: Jiri Slaby To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Junjie Mao , Jiri Slaby Subject: [PATCH 3.12 080/142] driver core: bus: Goto appropriate labels on failure in bus_add_device Date: Sat, 16 May 2015 09:37:20 +0200 Message-Id: <91350acb28a60304636f9a8d6f739e0b2e99ef10.1431761807.git.jslaby@suse.cz> X-Mailer: git-send-email 2.3.7 In-Reply-To: <70c3d4ae1322b9e9bd7443ef574af5635234a0fa.1431761807.git.jslaby@suse.cz> References: <70c3d4ae1322b9e9bd7443ef574af5635234a0fa.1431761807.git.jslaby@suse.cz> In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1430 Lines: 47 From: Junjie Mao 3.12-stable review patch. If anyone has any objections, please let me know. =============== 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 Signed-off-by: Jiri Slaby --- 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 aed92e41f291..f95dead9a8c2 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) -- 2.3.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/