if (be->cpu_dai->playback_widget == widget) return be;
- for (i = 0; i < be->num_codecs; i++) { - struct snd_soc_dai *dai = be->codec_dais[i]; + for_each_rtd_codec_dai(be, i, dai) { if (dai->playback_widget == widget) return be; }
This conversion is not equivalent. Original code always goes through num_codecs, new code stops at first NULL pointer. I assume there are always non-NULL pointers in the list, but perhaps new code should not be ignoring the NULLs silently?