Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: jaska.uimonen@intel.com
Cc: alsa-devel@alsa-project.org
Subject: [bug report] ASoC: SOF: topology: use set_get_data in process load
Date: Mon, 19 Aug 2019 14:45:35 +0300	[thread overview]
Message-ID: <20190819114535.GA24323@mwanda> (raw)

Hello Jaska Uimonen,

The patch cac974a51ebb: "ASoC: SOF: topology: use set_get_data in
process load" from Aug 9, 2019, leads to the following static checker
warning:

	sound/soc/sof/topology.c:1857 sof_process_load()
	warn: 'ipc_data_size' unsigned <= 0

sound/soc/sof/topology.c
  1825  static int sof_process_load(struct snd_soc_component *scomp, int index,
  1826                              struct snd_sof_widget *swidget,
  1827                              struct snd_soc_tplg_dapm_widget *tw,
  1828                              struct sof_ipc_comp_reply *r,
  1829                              int type)
  1830  {
  1831          struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
  1832          struct snd_soc_dapm_widget *widget = swidget->widget;
  1833          struct snd_soc_tplg_private *private = &tw->priv;
  1834          struct sof_ipc_comp_process *process = NULL;
  1835          struct sof_widget_data *wdata = NULL;
  1836          size_t ipc_data_size = 0;
                ^^^^^^^^^^^^^^^^^^^^
Unsigned.

  1837          size_t ipc_size;
  1838          int offset = 0;
  1839          int ret = 0;
  1840          int i;
  1841  
  1842          if (type == SOF_COMP_NONE) {
  1843                  dev_err(sdev->dev, "error: invalid process comp type %d\n",
  1844                          type);
  1845                  return -EINVAL;
  1846          }
  1847  
  1848          /* allocate struct for widget control data sizes and types */
  1849          if (widget->num_kcontrols) {
  1850                  wdata = kcalloc(widget->num_kcontrols,
  1851                                  sizeof(*wdata),
  1852                                  GFP_KERNEL);
  1853  
  1854                  if (!wdata)
  1855                          return -ENOMEM;
  1856  
  1857                  /* get possible component controls and get size of all pdata */
  1858                  ipc_data_size = sof_get_control_data(sdev, widget, wdata);
  1859  
  1860                  if (ipc_data_size <= 0) {


The sof_get_control_data() returns negative error codes, but it's also
declared as unsigned.  But the main reason I'm reporting this instead of
fixing it myself (besides laziness) is that I was wondering if it was
really handling zero returns correctly.  Should we really return success
in that situation?

  1861                          ret = ipc_data_size;
  1862                          goto out;
  1863                  }
  1864          }
  1865  

regards,
dan carpenter

                 reply	other threads:[~2019-08-19 11:45 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=20190819114535.GA24323@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=jaska.uimonen@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