From patchwork Sat Apr 18 20:00:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 18859 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 n3IK2FPW024055 for ; Sat, 18 Apr 2009 20:02:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753111AbZDRUCP (ORCPT ); Sat, 18 Apr 2009 16:02:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753598AbZDRUCP (ORCPT ); Sat, 18 Apr 2009 16:02:15 -0400 Received: from hera.kernel.org ([140.211.167.34]:35062 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753111AbZDRUCO (ORCPT ); Sat, 18 Apr 2009 16:02:14 -0400 Received: from [192.168.101.7] (adsl-75-61-233-163.dsl.pltn13.sbcglobal.net [75.61.233.163]) (authenticated bits=0) by hera.kernel.org (8.14.2/8.13.8) with ESMTP id n3IK1297019472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 18 Apr 2009 20:01:03 GMT Message-ID: <49EA3176.4010901@kernel.org> Date: Sat, 18 Apr 2009 13:00:54 -0700 From: Yinghai Lu User-Agent: Thunderbird 2.0.0.19 (X11/20081227) MIME-Version: 1.0 To: Greg KH , Linus Torvalds , Andrew Morton , Ingo Molnar CC: Jesse Barnes , "H. Peter Anvin" , Thomas Gleixner , "linux-kernel@vger.kernel.org" , linux-pci@vger.kernel.org Subject: [PATCH] driver: dont update dev_name if it is not changed References: <20090416172803.GB16618@elte.hu> <49E7916C.7050701@kernel.org> <20090416235452.GE21405@elte.hu> <20090417131633.GA30578@elte.hu> <49E8FD0B.2050308@zytor.com> <49E96731.1000501@kernel.org> <49EA27B9.3030004@kernel.org> <20090418192314.GA22107@suse.de> In-Reply-To: <20090418192314.GA22107@suse.de> X-Virus-Scanned: ClamAV 0.93.3/9255/Sat Apr 18 12:31:15 2009 on hera.kernel.org X-Virus-Status: Clean Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org notice one system /proc/iomem some entries missed the name for pci_devices it turns that dev->dev.kobj name is changed after device_add. [Impact: fix corrupted names in /proc/iomem ] Signed-off-by: Yinghai Lu --- lib/kobject.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-2.6/lib/kobject.c =================================================================== --- linux-2.6.orig/lib/kobject.c +++ linux-2.6/lib/kobject.c @@ -216,12 +216,21 @@ int kobject_set_name_vargs(struct kobjec va_list vargs) { const char *old_name = kobj->name; + char *new_name; char *s; - kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs); - if (!kobj->name) + new_name = kvasprintf(GFP_KERNEL, fmt, vargs); + if (!new_name) return -ENOMEM; + /* different ? */ + if (!strcmp(new_name, old_name)) { + kfree(new_name); + return 0; + } + + kobj->name = new_name; + /* ewww... some of these buggers have '/' in the name ... */ while ((s = strchr(kobj->name, '/'))) s[0] = '!';