Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755485Ab2HHGiS (ORCPT ); Wed, 8 Aug 2012 02:38:18 -0400 Received: from hqemgate03.nvidia.com ([216.228.121.140]:15568 "EHLO hqemgate03.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752577Ab2HHGiQ convert rfc822-to-8bit (ORCPT ); Wed, 8 Aug 2012 02:38:16 -0400 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Tue, 07 Aug 2012 23:33:07 -0700 From: Venu Byravarasu To: Lars-Peter Clausen CC: "linux-kernel@vger.kernel.org" Date: Wed, 8 Aug 2012 12:08:10 +0530 Subject: RE: question on devm_kfree Thread-Topic: question on devm_kfree Thread-Index: Ac11Lvlx79APrLJiSYWzVCoSaQUXTgAAMvOw Message-ID: References: <5021FF92.8030904@nvidia.com> <50220779.9000206@metafoo.de> In-Reply-To: <50220779.9000206@metafoo.de> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1194 Lines: 35 > -----Original Message----- > From: Lars-Peter Clausen [mailto:lars@metafoo.de] > Sent: Wednesday, August 08, 2012 12:00 PM > To: Venu Byravarasu > Cc: linux-kernel@vger.kernel.org > Subject: Re: question on devm_kfree > > 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 Thanks 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/