Message ID | 20200415162849.308-1-amadeuszx.slawinski@linux.intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 326b509238171d37402dbe308e154cc234ed1960 |
Headers | show |
Series | [1/3] ASoC: codecs: hdac_hdmi: Fix incorrect use of list_for_each_entry | expand |
On Wed, Apr 15, 2020 at 12:28:49PM -0400, Amadeusz Sławiński wrote: > If we don't find any pcm, pcm will point at address at an offset from > the the list head and not a meaningful structure. Fix this by returning > correct pcm if found and NULL if not. Found with coccinelle. I only have patch 1/3 here and no cover letter - what's going on with dependencies?
On 4/15/2020 7:25 PM, Mark Brown wrote: > On Wed, Apr 15, 2020 at 12:28:49PM -0400, Amadeusz Sławiński wrote: >> If we don't find any pcm, pcm will point at address at an offset from >> the the list head and not a meaningful structure. Fix this by returning >> correct pcm if found and NULL if not. Found with coccinelle. > > I only have patch 1/3 here and no cover letter - what's going on with > dependencies? > Oops, I'm sorry about this. There is only this patch, do you want me to resend?
On Thu, Apr 16, 2020 at 09:27:29AM +0200, Amadeusz Sławiński wrote: > Oops, I'm sorry about this. There is only this patch, do you want me to > resend? No, it's OK.
diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index fba9b749839d..f26b77faed59 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -142,14 +142,14 @@ static struct hdac_hdmi_pcm * hdac_hdmi_get_pcm_from_cvt(struct hdac_hdmi_priv *hdmi, struct hdac_hdmi_cvt *cvt) { - struct hdac_hdmi_pcm *pcm = NULL; + struct hdac_hdmi_pcm *pcm; list_for_each_entry(pcm, &hdmi->pcm_list, head) { if (pcm->cvt == cvt) - break; + return pcm; } - return pcm; + return NULL; } static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
If we don't find any pcm, pcm will point at address at an offset from the the list head and not a meaningful structure. Fix this by returning correct pcm if found and NULL if not. Found with coccinelle. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> --- sound/soc/codecs/hdac_hdmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)