Re: [PATCH v1 3/3] iio: adc: meson_saradc: Use temporary variable for struct device

kernel test robot
2022-06-01T00:44:41Z

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on v5.18 next-20220531]
[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/intel-lab-lkp/linux/commits/Andy-Shevchenko/iio-adc-meson_saradc-Convert-to-use-dev_err_probe/20220601-052117
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20220601/202206010812.Xy2yMeXw-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 11.3.0
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
# https://github.com/intel-lab-lkp/linux/commit/d2d128394df620a157f32fab808d46e5983f73e5
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/iio-adc-meson_saradc-Convert-to-use-dev_err_probe/20220601-052117
git checkout d2d128394df620a157f32fab808d46e5983f73e5
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/iio/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

drivers/iio/adc/meson_saradc.c: In function 'meson_sar_adc_clk_init':
>> drivers/iio/adc/meson_saradc.c:652:24: warning: 'dev' is used uninitialized [-Wuninitialized]
652 | struct device *dev = dev->parent;
| ^~~

vim +/dev +652 drivers/iio/adc/meson_saradc.c

646
647 static int meson_sar_adc_clk_init(struct iio_dev *indio_dev,
648 void __iomem *base)
649 {
650 struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
651 struct device *idev = &indio_dev->dev;
> 652 struct device *dev = dev->parent;
653 struct clk_init_data init;
654 const char *clk_parents[1];
655
656 init.name = devm_kasprintf(idev, GFP_KERNEL, "%s#adc_div", dev_name(dev));
657 if (!init.name)
658 return -ENOMEM;
659
660 init.flags = 0;
661 init.ops = &clk_divider_ops;
662 clk_parents[0] = __clk_get_name(priv->clkin);
663 init.parent_names = clk_parents;
664 init.num_parents = 1;
665
666 priv->clk_div.reg = base + MESON_SAR_ADC_REG3;
667 priv->clk_div.shift = MESON_SAR_ADC_REG3_ADC_CLK_DIV_SHIFT;
668 priv->clk_div.width = MESON_SAR_ADC_REG3_ADC_CLK_DIV_WIDTH;
669 priv->clk_div.hw.init = &init;
670 priv->clk_div.flags = 0;
671
672 priv->adc_div_clk = devm_clk_register(idev, &priv->clk_div.hw);
673 if (WARN_ON(IS_ERR(priv->adc_div_clk)))
674 return PTR_ERR(priv->adc_div_clk);
675
676 init.name = devm_kasprintf(idev, GFP_KERNEL, "%s#adc_en", dev_name(dev));
677 if (!init.name)
678 return -ENOMEM;
679
680 init.flags = CLK_SET_RATE_PARENT;
681 init.ops = &clk_gate_ops;
682 clk_parents[0] = __clk_get_name(priv->adc_div_clk);
683 init.parent_names = clk_parents;
684 init.num_parents = 1;
685
686 priv->clk_gate.reg = base + MESON_SAR_ADC_REG3;
687 priv->clk_gate.bit_idx = __ffs(MESON_SAR_ADC_REG3_CLK_EN);
688 priv->clk_gate.hw.init = &init;
689
690 priv->adc_clk = devm_clk_register(idev, &priv->clk_gate.hw);
691 if (WARN_ON(IS_ERR(priv->adc_clk)))
692 return PTR_ERR(priv->adc_clk);
693
694 return 0;
695 }
696

--
0-DAY CI Kernel Test Service