Hi Jerome, Mark, again
Current aiu-fifo.c is using kzalloc()/kfree(), but we can replace it by devm_kzalloc(), and remove kfree(). This patch do it.
I'm not sure about this change Kuninori.
This is the dai probe, not the device driver probe. If I'm not mistaken it gets called when binding the card.
The components and card drivers are different here.
If the card probes several times for any reason, EPROBE_DEFER for example, wouldn't this allocate the memory several times without releasing it ?
Yes, indeed. You'd need to move the allocation to the device level probe to convert to devm (which *would* be a good thing to do if possible).
Oh, yes, indeed. I will fixup it in v2.
If there was EPROBE_DEFER issue, snd_soc_bind_card() will return at (A) *before* calling probe callback on each DAIs at (B). So, I think calling devm_kzalloc() at .probe is maybe no problem.
static int snd_soc_bind_card(...) { ...
for_each_card_prelinks(card, i, dai_link) { (A) ret = snd_soc_add_pcm_runtime(card, dai_link); if (ret < 0) goto probe_end; }
...
/* probe all DAI links on this card */ (B) ret = soc_probe_link_dais(card); ... }
Thank you for your help !!
Best regards --- Kuninori Morimoto