All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [broonie-ci:filekCZcLQ 7/13] sound/soc/codecs/rt1320-sdw.c:564 rt1320_load_mcu_patch() warn: impossible condition '(addr > 4295491583) => (0-u32max > 4295491583)'
Date: Tue, 1 Oct 2024 11:47:09 +0800	[thread overview]
Message-ID: <202410011117.3dImGD4j-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Shuming Fan <shumingf@realtek.com>
CC: Mark Brown <broonie@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/ci.git filekCZcLQ
head:   4649cbd97fdae5069e9a71cd7669b62b90e03669
commit: d72498fad93abf1817c4998d172a3d7f98f76bbe [7/13] ASoC: rt1320: reads patch code from firmware file
:::::: branch date: 6 hours ago
:::::: commit date: 29 hours ago
config: i386-randconfig-141-20240930 (https://download.01.org/0day-ci/archive/20241001/202410011117.3dImGD4j-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)

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 <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202410011117.3dImGD4j-lkp@intel.com/

smatch warnings:
sound/soc/codecs/rt1320-sdw.c:564 rt1320_load_mcu_patch() warn: impossible condition '(addr > 4295491583) => (0-u32max > 4295491583)'

vim +564 sound/soc/codecs/rt1320-sdw.c

f465d10cd73188 Shuming Fan 2024-09-02  527  
d72498fad93abf Shuming Fan 2024-09-14  528  /*
d72498fad93abf Shuming Fan 2024-09-14  529   * The 'patch code' is written to the patch code area.
d72498fad93abf Shuming Fan 2024-09-14  530   * The patch code area is used for SDCA register expansion flexibility.
d72498fad93abf Shuming Fan 2024-09-14  531   */
d72498fad93abf Shuming Fan 2024-09-14  532  static void rt1320_load_mcu_patch(struct rt1320_sdw_priv *rt1320)
d72498fad93abf Shuming Fan 2024-09-14  533  {
d72498fad93abf Shuming Fan 2024-09-14  534  	struct sdw_slave *slave = rt1320->sdw_slave;
d72498fad93abf Shuming Fan 2024-09-14  535  	const struct firmware *patch;
d72498fad93abf Shuming Fan 2024-09-14  536  	const char *filename;
d72498fad93abf Shuming Fan 2024-09-14  537  	unsigned int addr, val;
d72498fad93abf Shuming Fan 2024-09-14  538  	const unsigned char *ptr;
d72498fad93abf Shuming Fan 2024-09-14  539  	int ret, i;
d72498fad93abf Shuming Fan 2024-09-14  540  
d72498fad93abf Shuming Fan 2024-09-14  541  	if (rt1320->version_id <= RT1320_VB)
d72498fad93abf Shuming Fan 2024-09-14  542  		filename = RT1320_VAB_MCU_PATCH;
d72498fad93abf Shuming Fan 2024-09-14  543  	else
d72498fad93abf Shuming Fan 2024-09-14  544  		filename = RT1320_VC_MCU_PATCH;
d72498fad93abf Shuming Fan 2024-09-14  545  
d72498fad93abf Shuming Fan 2024-09-14  546  	/* load the patch code here */
d72498fad93abf Shuming Fan 2024-09-14  547  	ret = request_firmware(&patch, filename, &slave->dev);
d72498fad93abf Shuming Fan 2024-09-14  548  	if (ret) {
d72498fad93abf Shuming Fan 2024-09-14  549  		dev_err(&slave->dev, "%s: Failed to load %s firmware", __func__, filename);
d72498fad93abf Shuming Fan 2024-09-14  550  		regmap_write(rt1320->regmap, 0xc598, 0x00);
d72498fad93abf Shuming Fan 2024-09-14  551  		regmap_write(rt1320->regmap, 0x10007000, 0x67);
d72498fad93abf Shuming Fan 2024-09-14  552  		regmap_write(rt1320->regmap, 0x10007001, 0x80);
d72498fad93abf Shuming Fan 2024-09-14  553  		regmap_write(rt1320->regmap, 0x10007002, 0x00);
d72498fad93abf Shuming Fan 2024-09-14  554  		regmap_write(rt1320->regmap, 0x10007003, 0x00);
d72498fad93abf Shuming Fan 2024-09-14  555  	} else {
d72498fad93abf Shuming Fan 2024-09-14  556  		ptr = (const unsigned char *)patch->data;
d72498fad93abf Shuming Fan 2024-09-14  557  		if ((patch->size % 8) == 0) {
d72498fad93abf Shuming Fan 2024-09-14  558  			for (i = 0; i < patch->size; i += 8) {
d72498fad93abf Shuming Fan 2024-09-14  559  				addr = (ptr[i] & 0xff) | (ptr[i + 1] & 0xff) << 8 |
d72498fad93abf Shuming Fan 2024-09-14  560  					(ptr[i + 2] & 0xff) << 16 | (ptr[i + 3] & 0xff) << 24;
d72498fad93abf Shuming Fan 2024-09-14  561  				val = (ptr[i + 4] & 0xff) | (ptr[i + 5] & 0xff) << 8 |
d72498fad93abf Shuming Fan 2024-09-14  562  					(ptr[i + 6] & 0xff) << 16 | (ptr[i + 7] & 0xff) << 24;
d72498fad93abf Shuming Fan 2024-09-14  563  
d72498fad93abf Shuming Fan 2024-09-14 @564  				if (addr > 0x10007ffff || addr < 0x10007000) {
d72498fad93abf Shuming Fan 2024-09-14  565  					dev_err(&slave->dev, "%s: the address 0x%x is wrong", __func__, addr);
d72498fad93abf Shuming Fan 2024-09-14  566  					goto _exit_;
d72498fad93abf Shuming Fan 2024-09-14  567  				}
d72498fad93abf Shuming Fan 2024-09-14  568  				if (val > 0xff) {
d72498fad93abf Shuming Fan 2024-09-14  569  					dev_err(&slave->dev, "%s: the value 0x%x is wrong", __func__, val);
d72498fad93abf Shuming Fan 2024-09-14  570  					goto _exit_;
d72498fad93abf Shuming Fan 2024-09-14  571  				}
d72498fad93abf Shuming Fan 2024-09-14  572  				regmap_write(rt1320->regmap, addr, val);
d72498fad93abf Shuming Fan 2024-09-14  573  			}
d72498fad93abf Shuming Fan 2024-09-14  574  		}
d72498fad93abf Shuming Fan 2024-09-14  575  _exit_:
d72498fad93abf Shuming Fan 2024-09-14  576  		release_firmware(patch);
d72498fad93abf Shuming Fan 2024-09-14  577  	}
d72498fad93abf Shuming Fan 2024-09-14  578  }
d72498fad93abf Shuming Fan 2024-09-14  579  

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

             reply	other threads:[~2024-10-01  3:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01  3:47 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-10-01  7:12 [broonie-ci:filekCZcLQ 7/13] sound/soc/codecs/rt1320-sdw.c:564 rt1320_load_mcu_patch() warn: impossible condition '(addr > 4295491583) => (0-u32max > 4295491583)' Dan Carpenter

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=202410011117.3dImGD4j-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.