All of lore.kernel.org
 help / color / mirror / Atom feed
* question about bgpio_remove (drivers/gpio/gpio-generic.c)
@ 2011-12-26 17:10 Julia Lawall
  0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2011-12-26 17:10 UTC (permalink / raw)
  To: grant.likely, linus.walleij; +Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-12-26 17:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-26 17:10 question about bgpio_remove (drivers/gpio/gpio-generic.c) Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.