public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Venu Byravarasu <vbyravarasu@nvidia.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: question on devm_kfree
Date: Wed, 08 Aug 2012 08:30:17 +0200	[thread overview]
Message-ID: <50220779.9000206@metafoo.de> (raw)
In-Reply-To: <5021FF92.8030904@nvidia.com>

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

  reply	other threads:[~2012-08-08  6:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-08  5:56 question on devm_kfree Venu Byravarasu
2012-08-08  6:30 ` Lars-Peter Clausen [this message]
2012-08-08  6:38   ` Venu Byravarasu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50220779.9000206@metafoo.de \
    --to=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vbyravarasu@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox