LKML Archive on
help / color / mirror / Atom feed
From: Gen Zhang <>
To: Kalle Valo <>
Subject: Re: [PATCH] wlcore: spi: Fix a memory leaking bug in wl1271_probe()
Date: Tue, 28 May 2019 20:38:58 +0800	[thread overview]
Message-ID: <20190528123858.GA23855@zhanggen-UX430UQ> (raw)
In-Reply-To: <>

On Tue, May 28, 2019 at 03:33:09PM +0300, Kalle Valo wrote:
> Yeah, I don't see how that thread proves that these patches are correct.
Sure, I didn't mean that we came to an agreement that these patches are
> > Further, I e-mailed Greg K-H about when should we use devm_kmalloc().
> >
> > On Tue, May 28, 2019 at 08:32:57AM +0800, Gen Zhang wrote:
> >> devm_kmalloc() is used to allocate memory for a driver dev. Comments
> >> above the definition and doc 
> >> ( all
> >> imply that allocated the memory is automatically freed on driver attach,
> >> no matter allocation fail or not. However, I examined the code, and
> >> there are many sites that devm_kfree() is used to free devm_kmalloc().
> >> e.g. hisi_sas_debugfs_init() in drivers/scsi/hisi_sas/hisi_sas_main.c.
> >> So I am totally confused about this issue. Can anybody give me some
> >> guidance? When should we use devm_kfree()?
> > He replied: If you "know" you need to free the memory now, 
> > call devm_kfree(). If you want to wait for it to be cleaned up latter, 
> > like normal, then do not call it.
> >
> > So could please look in to this issue?
> Sorry, no time to investigate this in detail. If you think the patches
> are correct you can resend them and get someone familiar with the driver
> to provide Reviewed-by, then I will apply them.
> -- 
> Kalle Valo
Ok, thanks for your time. I will follow your suggestions.


      reply	other threads:[~2019-05-28 12:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-24  3:02 Gen Zhang
2019-05-28 11:39 ` Kalle Valo
     [not found] ` <>
2019-05-28 12:14   ` Gen Zhang
2019-05-28 12:33     ` Kalle Valo
2019-05-28 12:38       ` Gen Zhang [this message]

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:

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

  git send-email \
    --in-reply-to=20190528123858.GA23855@zhanggen-UX430UQ \ \ \ \ \ \ \
    --subject='Re: [PATCH] wlcore: spi: Fix a memory leaking bug in wl1271_probe()' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).