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;
....
{
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???
//do sthm:
if (ret != 0 )
return -EINVAL; //let's assume there we returned from probe, what with allocated so far memory???
...
}
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies