probe fail, what with devm_kzalloc, kcalloc data?
Tomek The Messenger
tomekthemessenger at gmail.com
Fri Apr 3 08:47:50 EDT 2020
Hi
What happens with devm_kzalloc and devm_kcalloc data when probe function
returns not 0?
Is this memory automatically deallocated?
Example below:
static struct my_data* my_static_pointer;
static int somedriver_do_probe(struct platform_device *pdev)
{
int ret;
struct device *dev = &pdev->dev;
dev_info(dev, "probe\n");
my_static_pointer= devm_kzalloc(dev, sizeof(struct my_data), GFP_KERNEL);
if (! my_static_pointer )
return -ENOMEM;
....
let's say memory was also allocated with devm_kcalloc somewhere in the
meantime
...
//do sthm:
if (ret != 0 )
return -EINVAL; //let's assume there we returned from probe, what with
allocated so far memory???
...
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20200403/34d91966/attachment.html>
More information about the Kernelnewbies
mailing list