Re: [PATCH v7 3/6] clk: ralink: add clock driver for mt7621 SoC

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

 



Hi Sergio,

I love your patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on clk/clk-next robh/for-next linus/master v5.11 next-20210216]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sergio-Paracuellos/MIPS-ralink-add-CPU-clock-detection-and-clock-driver-for-MT7621/20210217-194316
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 4eb839aef182fccf8995ee439fc2b48d43e45918
config: riscv-randconfig-r036-20210217 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/9b83f7b7032e26686ddc5d89e82ee2df4dc260d3
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Sergio-Paracuellos/MIPS-ralink-add-CPU-clock-detection-and-clock-driver-for-MT7621/20210217-194316
        git checkout 9b83f7b7032e26686ddc5d89e82ee2df4dc260d3
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/clk/ralink/clk-mt7621.c:459:2: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (!clk_data)
           ^~~~~~~~~~~~~~
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:30: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/ralink/clk-mt7621.c:517:9: note: uninitialized use occurs here
           return ret;
                  ^~~
   drivers/clk/ralink/clk-mt7621.c:459:2: note: remove the 'if' if its condition is always false
           if (!clk_data)
           ^~~~~~~~~~~~~~
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   drivers/clk/ralink/clk-mt7621.c:451:2: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (IS_ERR(priv->memc)) {
           ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:30: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/ralink/clk-mt7621.c:517:9: note: uninitialized use occurs here
           return ret;
                  ^~~
   drivers/clk/ralink/clk-mt7621.c:451:2: note: remove the 'if' if its condition is always false
           if (IS_ERR(priv->memc)) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   drivers/clk/ralink/clk-mt7621.c:445:2: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (IS_ERR(priv->sysc)) {
           ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:30: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/ralink/clk-mt7621.c:517:9: note: uninitialized use occurs here
           return ret;
                  ^~~
   drivers/clk/ralink/clk-mt7621.c:445:2: note: remove the 'if' if its condition is always false
           if (IS_ERR(priv->sysc)) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   drivers/clk/ralink/clk-mt7621.c:438:9: note: initialize the variable 'ret' to silence this warning
           int ret, i, count;
                  ^
                   = 0
   3 warnings generated.


vim +459 drivers/clk/ralink/clk-mt7621.c

   431	
   432	static int mt7621_clk_probe(struct platform_device *pdev)
   433	{
   434		struct device_node *np = pdev->dev.of_node;
   435		struct clk_hw_onecell_data *clk_data;
   436		struct device *dev = &pdev->dev;
   437		struct mt7621_clk_priv *priv;
   438		int ret, i, count;
   439	
   440		priv = kzalloc(sizeof(*priv), GFP_KERNEL);
   441		if (!priv)
   442			return -ENOMEM;
   443	
   444		priv->sysc = syscon_regmap_lookup_by_phandle(np, "ralink,sysctl");
   445		if (IS_ERR(priv->sysc)) {
   446			dev_err(dev, "Could not get sysc syscon regmap\n");
   447			goto free_clk_priv;
   448		}
   449	
   450		priv->memc = syscon_regmap_lookup_by_phandle(np, "ralink,memctl");
   451		if (IS_ERR(priv->memc)) {
   452			dev_err(dev, "Could not get memc syscon regmap\n");
   453			goto free_clk_priv;
   454		}
   455	
   456		count = ARRAY_SIZE(mt7621_clks_base) +
   457			ARRAY_SIZE(mt7621_fixed_clks) + ARRAY_SIZE(mt7621_gates);
   458		clk_data = kzalloc(struct_size(clk_data, hws, count), GFP_KERNEL);
 > 459		if (!clk_data)
   460			goto free_clk_priv;
   461	
   462		for (i = 0; i < ARRAY_SIZE(mt7621_clks_base); i++)
   463			clk_data->hws[i] = mt7621_clk_early[i];
   464	
   465		ret = mt7621_register_fixed_clocks(dev, clk_data);
   466		if (ret) {
   467			dev_err(dev, "Couldn't register fixed clocks\n");
   468			goto free_clk_data;
   469		}
   470	
   471		ret = mt7621_register_gates(dev, clk_data, priv);
   472		if (ret) {
   473			dev_err(dev, "Couldn't register fixed clock gates\n");
   474			goto unreg_clk_fixed;
   475		}
   476	
   477		clk_data->num = count;
   478	
   479		ret = mt7621_prepare_enable_clocks(clk_data);
   480		if (ret) {
   481			dev_err(dev, "Couldn't register fixed clock gates\n");
   482			goto unreg_clk_gates;
   483		}
   484	
   485		ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, clk_data);
   486		if (ret) {
   487			dev_err(dev, "Couldn't add clk hw provider\n");
   488			goto disable_clks;
   489		}
   490	
   491		return 0;
   492	
   493	disable_clks:
   494		for (i = 0; i < MT7621_CLK_MAX; i++)
   495			clk_disable_unprepare(clk_data->hws[i]->clk);
   496	
   497	unreg_clk_gates:
   498		for (i = 0; i < ARRAY_SIZE(mt7621_gates); i++) {
   499			struct mt7621_gate *sclk = &mt7621_gates[i];
   500	
   501			clk_hw_unregister(&sclk->hw);
   502		}
   503	
   504	unreg_clk_fixed:
   505		for (i = 0; i < ARRAY_SIZE(mt7621_fixed_clks); i++) {
   506			struct mt7621_fixed_clk *sclk = &mt7621_fixed_clks[i];
   507	
   508			clk_hw_unregister_fixed_rate(sclk->hw);
   509		}
   510	
   511	free_clk_data:
   512		kfree(clk_data);
   513	
   514	free_clk_priv:
   515		kfree(priv);
   516	
   517		return ret;
   518	}
   519	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux