From patchwork Tue Oct 20 05:49:46 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 54881 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9K5nm5C004658 for ; Tue, 20 Oct 2009 05:49:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752484AbZJTFtn (ORCPT ); Tue, 20 Oct 2009 01:49:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752557AbZJTFtn (ORCPT ); Tue, 20 Oct 2009 01:49:43 -0400 Received: from palinux.external.hp.com ([192.25.206.14]:49370 "EHLO mail.parisc-linux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752269AbZJTFtm (ORCPT ); Tue, 20 Oct 2009 01:49:42 -0400 Received: by mail.parisc-linux.org (Postfix, from userid 26919) id BC242494009; Mon, 19 Oct 2009 23:49:46 -0600 (MDT) Date: Mon, 19 Oct 2009 23:49:46 -0600 From: Matthew Wilcox To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Jesse Barnes , linux-pci@vger.kernel.org Subject: [PATCH 1/3] Fix updating of named attribute groups Message-ID: <20091020054946.GD29158@parisc-linux.org> References: <20091020054740.GC29158@parisc-linux.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091020054740.GC29158@parisc-linux.org> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index fe61194..0c4d342 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c @@ -69,12 +69,19 @@ static int internal_create_group(struct kobject *kobj, int update, return -EINVAL; if (grp->name) { - error = sysfs_create_subdir(kobj, grp->name, &sd); - if (error) - return error; - } else - sd = kobj->sd; - sysfs_get(sd); + if (update) { + sd = sysfs_get_dirent(kobj->sd, grp->name); + if (!sd) + return -ENOENT; + } else { + error = sysfs_create_subdir(kobj, grp->name, &sd); + if (error) + return error; + sysfs_get(sd); + } + } else { + sd = sysfs_get(kobj->sd); + } error = create_files(sd, kobj, grp, update); if (error) { if (grp->name)