The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Niranjan H Y <niranjan.hy@ti.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org>,
	Bard Liao <yung-chuan.liao@linux.intel.com>
Subject: sound/soc/codecs/tas2783-sdw.c:814 tas2783_fw_ready() error: uninitialized symbol 'ret'.
Date: Wed, 29 Oct 2025 11:06:46 +0300	[thread overview]
Message-ID: <202510291226.2R3fbYNh-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8eefed8f65cc17c31fdf4ab32292b794b34893ad
commit: 4cc9bd8d7b32d59b86cb489a96aa8a7b9dd6a21b ASoc: tas2783A: Add soundwire based codec driver
config: arm64-randconfig-r073-20251029 (https://download.01.org/0day-ci/archive/20251029/202510291226.2R3fbYNh-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 14.3.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202510291226.2R3fbYNh-lkp@intel.com/

New smatch warnings:
sound/soc/codecs/tas2783-sdw.c:814 tas2783_fw_ready() error: uninitialized symbol 'ret'.

vim +/ret +814 sound/soc/codecs/tas2783-sdw.c

4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  748  static void tas2783_fw_ready(const struct firmware *fmw, void *context)
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  749  {
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  750  	struct tas2783_prv *tas_dev =
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  751  		(struct tas2783_prv *)context;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  752  	const u8 *buf = NULL;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  753  	s32 offset = 0, img_sz, file_blk_size, ret;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  754  	struct bin_header_t hdr;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  755  
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  756  	if (!fmw || !fmw->data) {
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  757  		/* No firmware binary, devices will work in ROM mode. */
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  758  		dev_err(tas_dev->dev,
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  759  			"Failed to read %s, no side-effect on driver running\n",
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  760  			tas_dev->rca_binaryname);
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  761  		ret = -EINVAL;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  762  		goto out;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  763  	}
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  764  
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  765  	mutex_lock(&tas_dev->pde_lock);
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  766  	img_sz = fmw->size;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  767  	buf = fmw->data;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  768  	offset += FW_DL_OFFSET;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  769  	while (offset < (img_sz - FW_FL_HDR)) {

If the firmware is too small the "ret" value might be uninitialized.

4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  770  		memset(&hdr, 0, sizeof(hdr));
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  771  		offset += read_header(&buf[offset], &hdr);
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  772  		dev_dbg(tas_dev->dev,
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  773  			"vndr=%d, file=%d, version=%d, len=%d, off=%d\n",
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  774  			hdr.vendor_id, hdr.file_id, hdr.version,
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  775  			hdr.length, offset);
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  776  		/* size also includes the header */
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  777  		file_blk_size = hdr.length - FW_FL_HDR;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  778  
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  779  		switch (hdr.file_id) {
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  780  		case 0:
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  781  			ret = sdw_nwrite_no_pm(tas_dev->sdw_peripheral,
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  782  					       PRAM_ADDR_START, file_blk_size,
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  783  					       &buf[offset]);
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  784  			if (ret < 0)
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  785  				dev_err(tas_dev->dev,
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  786  					"PRAM update failed: %d", ret);
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  787  			break;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  788  
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  789  		case 1:
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  790  			ret = sdw_nwrite_no_pm(tas_dev->sdw_peripheral,
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  791  					       YRAM_ADDR_START, file_blk_size,
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  792  					       &buf[offset]);
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  793  			if (ret < 0)
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  794  				dev_err(tas_dev->dev,
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  795  					"YRAM update failed: %d", ret);
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  796  
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  797  			break;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  798  
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  799  		default:
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  800  			ret = -EINVAL;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  801  			dev_err(tas_dev->dev, "Unsupported file");
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  802  			break;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  803  		}
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  804  
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  805  		if (ret == 0)
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  806  			offset += file_blk_size;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  807  		else
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  808  			break;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  809  	};
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  810  	mutex_unlock(&tas_dev->pde_lock);
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  811  	tas2783_update_calibdata(tas_dev);
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  812  
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  813  out:
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12 @814  	if (!ret)
                                                    ^^^^
Here.

4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  815  		tas_dev->fw_dl_success = true;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  816  	tas_dev->fw_dl_task_done = true;
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  817  	wake_up(&tas_dev->fw_wait);
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  818  	if (fmw)
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  819  		release_firmware(fmw);
4cc9bd8d7b32d5 Niranjan H Y 2025-09-12  820  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


                 reply	other threads:[~2025-10-29  8:06 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=202510291226.2R3fbYNh-lkp@intel.com \
    --to=dan.carpenter@linaro.org \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=niranjan.hy@ti.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    --cc=yung-chuan.liao@linux.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