On 07/21/2015 03:54 PM, Koro Chen wrote:
On Tue, 2015-07-21 at 11:51 +0200, Lars-Peter Clausen wrote:
Commit fdb6eb0a1287 ("ASoC: dapm: Modify widget stream name according to prefix") fixed the case where a DAPM route between a DAI widget and a DAC/ADC/AIF widget with a matching stream name was not created when the DAPM context was using a prefix.
Unfortunately the patch introduced a few issues on its own like leaking the dynamically allocated stream name memory and also not checking whether the allocation succeeded in the first place.
It is also incomplete in that it still does not handle the case where stream name of the widget is a substring of the stream name of the DAI, which is explicitly allowed and works fine if no DAPM prefix is used.
I think your solution looks reasonable. However, just curious, why didn't we use strstr(dai_w->name, w->sname) in the first place?
It's probably just an oversight when the code was developed initially.