<div dir="ltr"><div>Hi</div><div>What happens with devm_kzalloc and devm_kcalloc data when probe function returns not 0?</div><div>Is this memory automatically deallocated?</div><div>Example below:</div><div><br></div><div>static struct my_data* my_static_pointer;</div><br><div>static int somedriver_do_probe(struct platform_device *pdev)<br>{<br> int ret;<br> struct device *dev = &pdev->dev;<br><br> dev_info(dev, "probe\n");<br><br> my_static_pointer= devm_kzalloc(dev, sizeof(struct my_data), GFP_KERNEL);<br> if (!
my_static_pointer
)<br> return -ENOMEM;<br>....</div><div>let's say memory was also allocated with devm_kcalloc somewhere in the meantime</div><div>...<br>//do sthm:<br> if (ret != 0 )<br> return -EINVAL; //let's assume there we returned from probe, what with allocated so far memory???<br></div><div>...</div><div>}</div><div><br></div></div>