Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932283Ab2HHG2I (ORCPT ); Wed, 8 Aug 2012 02:28:08 -0400 Received: from mailhost.informatik.uni-hamburg.de ([134.100.9.70]:33580 "EHLO mailhost.informatik.uni-hamburg.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757822Ab2HHG2D (ORCPT ); Wed, 8 Aug 2012 02:28:03 -0400 Message-ID: <50220779.9000206@metafoo.de> Date: Wed, 08 Aug 2012 08:30:17 +0200 From: Lars-Peter Clausen User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20120613 Icedove/3.0.11 MIME-Version: 1.0 To: Venu Byravarasu CC: "linux-kernel@vger.kernel.org" Subject: Re: question on devm_kfree References: <5021FF92.8030904@nvidia.com> In-Reply-To: <5021FF92.8030904@nvidia.com> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 915 Lines: 25 On 08/08/2012 07:56 AM, Venu Byravarasu wrote: > As per comments related to devm_kzalloc, memory allocated using it is > freed automatically. > However there is a function called devm_kfree, comment section of which > says that it is used to free memory allocated using devm_kzalloc(). > If memory allocated by devm_kzalloc is freed automatically, what's the > need & significance of devm_kfree? > > Thanks, > Venu > Hi, Memory allocated with devm_kzalloc is freed at the end of the lifetime of the device it is attached to. If you for some reason want to free allocated with memory devm_kzalloc before that of the lifetime of the device can use devm_kfree. - Lars -- 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/