[chenxing:mstar_v6_5_reorder 3/700] drivers/clk/mstar/clk-msc313-upll.c:73:25: warning: unused variable 'numrates'

kernel test robot <[email protected]> Fri, 31 Jul 2026 04:07:06 +0800
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://github.com/linux-chenxing/linux.git mstar_v6_5_reorder
head:   1a5c60e65ea399670a5384b869c4958338af2799
commit: d2e2a3c660a4dfe32fe20cbe346161abac9b32da [3/700] clk: mstar: upll
config: nios2-allmodconfig (https://download.01.org/0day-ci/archive/20260731/[email protected]/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260731/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   drivers/clk/mstar/clk-msc313-upll.c: In function 'mstar_pll_common_probe':
>> drivers/clk/mstar/clk-msc313-upll.c:73:25: warning: unused variable 'numrates' [-Wunused-variable]
      73 |         int numparents, numrates, pllindex;
         |                         ^~~~~~~~
>> drivers/clk/mstar/clk-msc313-upll.c:73:13: warning: variable 'numparents' set but not used [-Wunused-but-set-variable]
      73 |         int numparents, numrates, pllindex;
         |             ^~~~~~~~~~
   At top level:
>> drivers/clk/mstar/clk-msc313-upll.c:36:31: warning: 'en_clk_upll_192m_field' defined but not used [-Wunused-const-variable=]
      36 | static const struct reg_field en_clk_upll_192m_field = REG_FIELD(REG_EN_PWRDN, 2, 2);
         |                               ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/clk/mstar/clk-msc313-upll.c:35:31: warning: 'upll_en_prdt2' defined but not used [-Wunused-const-variable=]
      35 | static const struct reg_field upll_en_prdt2 = REG_FIELD(REG_EN_PWRDN, 1, 1);
         |                               ^~~~~~~~~~~~~
>> drivers/clk/mstar/clk-msc313-upll.c:34:31: warning: 'clk0_upll_384_en_field' defined but not used [-Wunused-const-variable=]
      34 | static const struct reg_field clk0_upll_384_en_field = REG_FIELD(REG_EN_PWRDN, 0, 0);
         |                               ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/clk/mstar/clk-msc313-upll.c:33:31: warning: 'enxtal_field' defined but not used [-Wunused-const-variable=]
      33 | static const struct reg_field enxtal_field = REG_FIELD(REG_MAGIC, 7, 7);
         |                               ^~~~~~~~~~~~
>> drivers/clk/mstar/clk-msc313-upll.c:32:31: warning: 'enfrun_field' defined but not used [-Wunused-const-variable=]
      32 | static const struct reg_field enfrun_field = REG_FIELD(REG_MAGIC, 5, 5);
         |                               ^~~~~~~~~~~~
>> drivers/clk/mstar/clk-msc313-upll.c:31:31: warning: 'enddisc_field' defined but not used [-Wunused-const-variable=]
      31 | static const struct reg_field enddisc_field = REG_FIELD(REG_MAGIC, 4, 4);
         |                               ^~~~~~~~~~~~~


vim +/numrates +73 drivers/clk/mstar/clk-msc313-upll.c

    27	
    28	
    29	/* based on the comments from the upll powerdown code in the i2m sdk kernel */
    30	static const struct reg_field pd_field = REG_FIELD(REG_MAGIC, 1, 1);
  > 31	static const struct reg_field enddisc_field = REG_FIELD(REG_MAGIC, 4, 4);
  > 32	static const struct reg_field enfrun_field = REG_FIELD(REG_MAGIC, 5, 5);
  > 33	static const struct reg_field enxtal_field = REG_FIELD(REG_MAGIC, 7, 7);
  > 34	static const struct reg_field clk0_upll_384_en_field = REG_FIELD(REG_EN_PWRDN, 0, 0);
  > 35	static const struct reg_field upll_en_prdt2 = REG_FIELD(REG_EN_PWRDN, 1, 1);
  > 36	static const struct reg_field en_clk_upll_192m_field = REG_FIELD(REG_EN_PWRDN, 2, 2);
    37	static const struct reg_field ctrl_pd_clk0_audio_field = REG_FIELD(REG_EN_PWRDN, 3, 3);
    38	
    39	static const char* msc313_upll_outputs[] = {
    40		"384",
    41		"320",
    42	};
    43	static const u32 msc313_upll_output_rates[] = {
    44		384000000,
    45		320000000,
    46	};
    47	
    48	struct mstar_pll_output {
    49		struct mstar_upll *pll;
    50		u32 rate;
    51		struct clk_hw clk_hw;
    52	};
    53	
    54	struct mstar_upll {
    55		void __iomem *base;
    56		struct clk_onecell_data clk_data;
    57		struct mstar_pll_output *outputs;
    58		unsigned numoutputs;
    59	
    60		struct regmap_field *pd;
    61		struct regmap_field *pd_clk0_audio;
    62	};
    63	
    64	#define to_pll_output(_hw) container_of(_hw, struct mstar_pll_output, clk_hw)
    65	
    66	static int mstar_pll_common_probe(struct platform_device *pdev, struct mstar_upll **pll,
    67			const struct clk_ops *clk_ops)
    68	{
    69		struct device *dev = &pdev->dev;
    70		struct mstar_pll_output* output;
    71		struct clk_init_data clk_init = { };
    72		struct clk* clk;
  > 73		int numparents, numrates, pllindex;
    74		struct clk_onecell_data *clk_data;
    75		const char *parents[1];
    76		int numoutputs = ARRAY_SIZE(msc313_upll_outputs);
    77	
    78		numparents = of_clk_parent_fill(pdev->dev.of_node, parents, ARRAY_SIZE(parents));
    79	
    80		*pll = devm_kzalloc(&pdev->dev, sizeof(**pll), GFP_KERNEL);
    81		(*pll)->outputs = devm_kzalloc(&pdev->dev, sizeof((*pll)->outputs) * numoutputs, GFP_KERNEL);
    82		if (!(*pll)->outputs)
    83			return -ENOMEM;
    84	
    85		(*pll)->base = devm_platform_ioremap_resource(pdev, 0);
    86		if (IS_ERR((*pll)->base))
    87			return PTR_ERR((*pll)->base);
    88	
    89		clk_data = &(*pll)->clk_data;
    90		clk_data->clk_num = numoutputs;
    91		clk_data->clks = devm_kcalloc(&pdev->dev, numoutputs, sizeof(struct clk *), GFP_KERNEL);
    92		if (!clk_data->clks)
    93			return -ENOMEM;
    94	
    95		for (pllindex = 0; pllindex < numoutputs; pllindex++) {
    96			output = &(*pll)->outputs[pllindex];
    97			output->pll = *pll;
    98	
    99			output->clk_hw.init = &clk_init;
   100			clk_init.name = devm_kasprintf(dev, GFP_KERNEL, "%s_%s",
   101					dev_name(dev), msc313_upll_outputs[pllindex]);
   102			clk_init.ops = clk_ops;
   103			clk_init.num_parents = 1;
   104			clk_init.parent_names = parents;
   105	
   106			output->rate = msc313_upll_output_rates[pllindex];
   107	
   108			clk = clk_register(&pdev->dev, &output->clk_hw);
   109			if (IS_ERR(clk)) {
   110				printk("failed to register clk");
   111				return -ENOMEM;
   112			}
   113			clk_data->clks[pllindex] = clk;
   114		}
   115	
   116		return of_clk_add_provider(pdev->dev.of_node, of_clk_src_onecell_get, clk_data);
   117	}
   118	

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