[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAErzpmtbbWbt28KPaFLVdwzuWy3A7se7_WBN8q6aJrHLbtT-LQ@mail.gmail.com>
Date: Tue, 22 Aug 2017 21:24:32 +0800
From: Donglin Peng <dolinux.peng@...il.com>
To: Jeffy Chen <jeffy.chen@...k-chips.com>
Cc: linux-kernel@...r.kernel.org, dgreid@...omium.org,
Heiko Stübner <heiko@...ech.de>,
briannorris@...omium.org, mengdong.lin@...ux.intel.com,
mka@...omium.org, lars@...afoo.de, dianders@...omium.org,
Jaroslav Kysela <perex@...ex.cz>, alsa-devel@...a-project.org,
Mark Brown <broonie@...nel.org>, Takashi Iwai <tiwai@...e.com>,
Liam Girdwood <lgirdwood@...il.com>
Subject: Re: [PATCH v5 2/9] ASoC: soc-core: Allow searching dai driver name in snd_soc_find_dai
Hi jeffy,
On Tue, Aug 22, 2017 at 3:57 PM, Jeffy Chen <jeffy.chen@...k-chips.com> wrote:
> @@ -978,7 +978,8 @@ struct snd_soc_dai *snd_soc_find_dai(
> if (dlc->name && strcmp(component->name, dlc->name))
> continue;
> list_for_each_entry(dai, &component->dai_list, list) {
> - if (dlc->dai_name && strcmp(dai->name, dlc->dai_name))
> + if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)
> + && strcmp(dai->driver->name, dlc->dai_name))
In case that dai->driver->name is NULL, strcmp(dai->driver->name,
dlc->dai_name) will cause segmentation fault.
so I think that we can change it as the follows:
if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)
&& dai->driver->name &&
strcmp(dai->driver->name, dlc->dai_name))
> continue;
>
> return dai;
> --
> 2.11.0
>
>
Powered by blists - more mailing lists