question about bgpio_remove (drivers/gpio/gpio-generic.c)

From: Julia Lawall
Date: Mon Dec 26 2011 - 12:10:35 EST

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);


return err;

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.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at