[linux-next:master 6931/7876] drivers/remoteproc/xlnx_r5_remoteproc.c:914:11: warning: variable 'ret' is used uninitialized whenever 'if' condition is false

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   a59668a9397e7245b26e9be85d23f242ff757ae8
commit: a6b974b40f942b3e51124de588383009f6a42d2d [6931/7876] drivers: remoteproc: xlnx: Add Versal and Versal-NET support
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20240423/202404231839.oHiY9Lw8-lkp@xxxxxxxxx/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 5ef5eb66fb428aaf61fb51b709f065c069c11242)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240423/202404231839.oHiY9Lw8-lkp@xxxxxxxxx/reproduce)

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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404231839.oHiY9Lw8-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   In file included from drivers/remoteproc/xlnx_r5_remoteproc.c:8:
   In file included from include/linux/dma-mapping.h:11:
   In file included from include/linux/scatterlist.h:8:
   In file included from include/linux/mm.h:2208:
   include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     508 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     509 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     515 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     516 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     522 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     527 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     528 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     536 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     537 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/remoteproc/xlnx_r5_remoteproc.c:914:11: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
     914 |         else if (device_is_compatible(dev, "xlnx,zynqmp-r5fss"))
         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/remoteproc/xlnx_r5_remoteproc.c:917:6: note: uninitialized use occurs here
     917 |         if (ret) {
         |             ^~~
   drivers/remoteproc/xlnx_r5_remoteproc.c:914:7: note: remove the 'if' if its condition is always true
     914 |         else if (device_is_compatible(dev, "xlnx,zynqmp-r5fss"))
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     915 |                 ret = zynqmp_r5_get_tcm_node(cluster);
   drivers/remoteproc/xlnx_r5_remoteproc.c:907:9: note: initialize the variable 'ret' to silence this warning
     907 |         int ret, i;
         |                ^
         |                 = 0
   6 warnings generated.


vim +914 drivers/remoteproc/xlnx_r5_remoteproc.c

   890	
   891	/*
   892	 * zynqmp_r5_core_init()
   893	 * Create and initialize zynqmp_r5_core type object
   894	 *
   895	 * @cluster: pointer to zynqmp_r5_cluster type object
   896	 * @fw_reg_val: value expected by firmware to configure RPU cluster mode
   897	 * @tcm_mode: value expected by fw to configure TCM mode (lockstep or split)
   898	 *
   899	 * Return: 0 for success and error code for failure.
   900	 */
   901	static int zynqmp_r5_core_init(struct zynqmp_r5_cluster *cluster,
   902				       enum rpu_oper_mode fw_reg_val,
   903				       enum rpu_tcm_comb tcm_mode)
   904	{
   905		struct device *dev = cluster->dev;
   906		struct zynqmp_r5_core *r5_core;
   907		int ret, i;
   908	
   909		r5_core = cluster->r5_cores[0];
   910	
   911		/* Maintain backward compatibility for zynqmp by using hardcode TCM address. */
   912		if (of_find_property(r5_core->np, "reg", NULL))
   913			ret = zynqmp_r5_get_tcm_node_from_dt(cluster);
 > 914		else if (device_is_compatible(dev, "xlnx,zynqmp-r5fss"))
   915			ret = zynqmp_r5_get_tcm_node(cluster);
   916	
   917		if (ret) {
   918			dev_err(dev, "can't get tcm, err %d\n", ret);
   919			return ret;
   920		}
   921	
   922		for (i = 0; i < cluster->core_count; i++) {
   923			r5_core = cluster->r5_cores[i];
   924	
   925			/* Initialize r5 cores with power-domains parsed from dts */
   926			ret = of_property_read_u32_index(r5_core->np, "power-domains",
   927							 1, &r5_core->pm_domain_id);
   928			if (ret) {
   929				dev_err(dev, "failed to get power-domains property\n");
   930				return ret;
   931			}
   932	
   933			ret = zynqmp_pm_set_rpu_mode(r5_core->pm_domain_id, fw_reg_val);
   934			if (ret < 0) {
   935				dev_err(r5_core->dev, "failed to set RPU mode\n");
   936				return ret;
   937			}
   938	
   939			if (of_find_property(dev_of_node(dev), "xlnx,tcm-mode", NULL) ||
   940			    device_is_compatible(dev, "xlnx,zynqmp-r5fss")) {
   941				ret = zynqmp_pm_set_tcm_config(r5_core->pm_domain_id,
   942							       tcm_mode);
   943				if (ret < 0) {
   944					dev_err(r5_core->dev, "failed to configure TCM\n");
   945					return ret;
   946				}
   947			}
   948		}
   949	
   950		return 0;
   951	}
   952	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux