Re: [PATCH 2/2] mfd: sprd-sc27xx-spi: Add PMICs support for UMS9621 SoC

From: kernel test robot
Date: Tue Aug 22 2023 - 17:55:37 EST


Hi Jiansheng,

kernel test robot noticed the following build warnings:

[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on robh/for-next lee-leds/for-leds-next lee-mfd/for-mfd-fixes linus/master v6.5-rc7 next-20230822]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Jiansheng-Wu/dt-bindings-spi-Convert-sprd-spi-bindings-to-yaml/20230822-155400
base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
patch link: https://lore.kernel.org/r/20230822075113.25506-3-jiansheng.wu%40unisoc.com
patch subject: [PATCH 2/2] mfd: sprd-sc27xx-spi: Add PMICs support for UMS9621 SoC
config: nios2-allmodconfig (https://download.01.org/0day-ci/archive/20230823/202308230504.UYqC6CLk-lkp@xxxxxxxxx/config)
compiler: nios2-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230823/202308230504.UYqC6CLk-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/202308230504.UYqC6CLk-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/mfd/sprd-sc27xx-spi.c: In function 'sprd_pmic_spi_write':
>> drivers/mfd/sprd-sc27xx-spi.c:133:19: warning: 'pdata' is used uninitialized [-Wuninitialized]
133 | if (!pdata->slave_id) {
| ~~~~~^~~~~~~~~~
drivers/mfd/sprd-sc27xx-spi.c:129:38: note: 'pdata' was declared here
129 | const struct sprd_pmic_data *pdata;
| ^~~~~


vim +/pdata +133 drivers/mfd/sprd-sc27xx-spi.c

124
125 static int sprd_pmic_spi_write(void *context, const void *data, size_t count)
126 {
127 struct device *dev = context;
128 struct spi_device *spi = to_spi_device(dev);
129 const struct sprd_pmic_data *pdata;
130 int ret;
131 u32 *pmdata;
132
> 133 if (!pdata->slave_id) {
134 ret = spi_write(spi, data, count);
135 } else {
136 pdata = ((struct sprd_pmic *)spi_get_drvdata(spi))->pdata;
137
138 pmdata = kzalloc(count, GFP_KERNEL);
139 if (!pmdata)
140 return -ENOMEM;
141 memcpy(pmdata, data, count);
142 *pmdata += pdata->slave_id;
143 ret = spi_write(spi, (const void *)pmdata, count);
144 kfree(pmdata);
145 }
146 if (ret)
147 pr_err("pmic mfd write failed!\n");
148
149 return ret;
150 }
151

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