Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: jeeja.kp@intel.com
Cc: alsa-devel@alsa-project.org
Subject: [bug report] ASoC: hdac_hdmi: Add support for multiple ports to a PCM
Date: Wed, 22 Feb 2017 22:07:58 +0300	[thread overview]
Message-ID: <20170222185651.GA14103@mwanda> (raw)

Hello Jeeja KP,

The patch e0e5d3e5a53b: "ASoC: hdac_hdmi: Add support for multiple
ports to a PCM" from Feb 7, 2017, leads to the following static
checker warning:

	sound/soc/codecs/hdac_hdmi.c:2011 hdac_hdmi_dev_remove()
	error: potential NULL dereference 'port'.

sound/soc/codecs/hdac_hdmi.c
  1995  static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev)
  1996  {
  1997          struct hdac_hdmi_priv *hdmi = edev->private_data;
  1998          struct hdac_hdmi_pin *pin, *pin_next;
  1999          struct hdac_hdmi_cvt *cvt, *cvt_next;
  2000          struct hdac_hdmi_pcm *pcm, *pcm_next;
  2001          struct hdac_hdmi_port *port;
  2002          int i;
  2003  
  2004          snd_soc_unregister_codec(&edev->hdac.dev);
  2005  
  2006          list_for_each_entry_safe(pcm, pcm_next, &hdmi->pcm_list, head) {
  2007                  pcm->cvt = NULL;
  2008                  if (list_empty(&pcm->port_list))
  2009                          continue;
  2010  
  2011                  list_for_each_entry(port, &pcm->port_list, head)
  2012                          port = NULL;

It's not clear to me what this loop is supposed to do.  To me it looks
like it will Oops every single time without fail.

  2013  
  2014                  list_del(&pcm->head);
  2015                  kfree(pcm);
  2016          }
  2017  
  2018          list_for_each_entry_safe(cvt, cvt_next, &hdmi->cvt_list, head) {
  2019                  list_del(&cvt->head);
  2020                  kfree(cvt->name);
  2021                  kfree(cvt);
  2022          }
  2023  
  2024          list_for_each_entry_safe(pin, pin_next, &hdmi->pin_list, head) {
  2025                  for (i = 0; i < pin->num_ports; i++)
  2026                          pin->ports[i].pin = NULL;
  2027                  kfree(pin->ports);
  2028                  list_del(&pin->head);
  2029                  kfree(pin);
  2030          }
  2031  
  2032          return 0;
  2033  }

regards,
dan carpenter

                 reply	other threads:[~2017-02-22 19:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170222185651.GA14103@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=jeeja.kp@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox