mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: grant.likely@secretlab.ca, linus.walleij@stericsson.com
Cc: linux-kernel@vger.kernel.org
Subject: question about bgpio_remove (drivers/gpio/gpio-generic.c)
Date: Mon, 26 Dec 2011 18:10:32 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.02.1112261804000.1873@localhost6.localdomain6> (raw)

The function bgpio_remove in the file drivers/gpio/gpio-generic.c is 
defind as follows:

int bgpio_remove(struct bgpio_chip *bgc)
{
         int err = gpiochip_remove(&bgc->gc);

 	kfree(bgc);

 	return err;
}
EXPORT_SYMBOL_GPL(bgpio_remove);

But bgc is allocated using devm_kzalloc, not kzalloc, and thus the kfree 
would seem to result in a dangling pointer.  On the other hand, this 
function does not have access to the information required to call 
devm_kfree (&pdev->dev).  Since the function is exported, should the 
interface be maintained, and the allocation of bgc converted to use 
kzalloc?  Or should the interface be changed to add the required 
information.  The callers in the kernel have the require information 
available.

thanks,
julia

                 reply	other threads:[~2011-12-26 17:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=alpine.DEB.2.02.1112261804000.1873@localhost6.localdomain6 \
    --to=julia.lawall@lip6.fr \
    --cc=grant.likely@secretlab.ca \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®