drivers/soc/qcom/smem_dramc.c:385 smem_dram_parse() warn: unsigned 'ver' is never less than zero.

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   26260251022fbc2f248a3d747a9b2b961b18d2d8
commit: 1d234eeafc56af8c9af6eee857f41a4310615e78 soc: qcom: smem: Expose DDR data from SMEM
date:   3 weeks ago
config: powerpc64-randconfig-r073-20260822 (https://download.01.org/0day-ci/archive/20260822/[email protected]/config)
compiler: powerpc64-linux-gcc (GCC) 8.5.0
smatch: v0.5.0-9187-g5189e3fb

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
| Fixes: 1d234eeafc56 ("soc: qcom: smem: Expose DDR data from SMEM")
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

smatch warnings:
drivers/soc/qcom/smem_dramc.c:385 smem_dram_parse() warn: unsigned 'ver' is never less than zero.

vim +/ver +385 drivers/soc/qcom/smem_dramc.c

   370	
   371	struct dentry *smem_dram_parse(struct qcom_smem *smem, struct device *dev)
   372	{
   373		struct dentry *debugfs_dir;
   374		enum ddr_info_version ver;
   375		struct smem_dram *dram;
   376		size_t actual_size;
   377		void *data;
   378	
   379		/* No need to check qcom_smem_is_available(), this func is called by the SMEM driver */
   380		data = __qcom_smem_get(smem, QCOM_SMEM_HOST_ANY, SMEM_DDR_INFO_ID, &actual_size);
   381		if (IS_ERR_OR_NULL(data))
   382			return ERR_PTR(-ENODATA);
   383	
   384		ver = smem_dram_infer_struct_version(actual_size);
 > 385		if (ver < 0) {

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.