Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763003AbZD1Qv2 (ORCPT ); Tue, 28 Apr 2009 12:51:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758107AbZD1QvQ (ORCPT ); Tue, 28 Apr 2009 12:51:16 -0400 Received: from mail-ew0-f176.google.com ([209.85.219.176]:50861 "EHLO mail-ew0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755714AbZD1QvP convert rfc822-to-8bit (ORCPT ); Tue, 28 Apr 2009 12:51:15 -0400 MIME-Version: 1.0 In-Reply-To: <49F7308A.2010804@kernel.org> References: <20090418192314.GA22107@suse.de> <49F6B1E6.7050008@kernel.org> <49F6B350.9080703@kernel.org> <49F71EF6.3050102@kernel.org> <49F72205.7030306@kernel.org> <20090428153906.GA8896@suse.de> <49F7260F.8030405@kernel.org> <49F7308A.2010804@kernel.org> From: Kay Sievers Date: Tue, 28 Apr 2009 18:50:52 +0200 Message-ID: Subject: Re: [RFC PATCH] use dev_set_name(,NULL) to prevent leaking To: Yinghai Lu Cc: Greg KH , Ingo Molnar , Linus Torvalds , Jesse Barnes , Andrew Morton , "H. Peter Anvin" , Thomas Gleixner , "linux-kernel@vger.kernel.org" , linux-pci@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1074 Lines: 26 On Tue, Apr 28, 2009 at 18:36, Yinghai Lu wrote: > Kay Sievers wrote: >> On Tue, Apr 28, 2009 at 17:51, Yinghai Lu wrote: >> >>> before device_register==>device_initialize is called, kobj->ref is still 0. >>> >>> will get warn from >>>                if (!kobj->state_initialized) >> >> Initialize the device before you do anything with it. And call _put() >> any time to get rid of ressources, which might have been allocated >> before registering. > > need to replace device_register with device_add and call device_initialize before device_set_name? Sounds right in the case you want to jump out between set_name() and _register() -- means you have an uninitialized device, where you can not call put_device(). Otherwise after a failing _register() it should work fine. Kay -- 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/