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

From: kernel test robot
Date: Tue Aug 22 2023 - 14:52:59 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: i386-buildonly-randconfig-004-20230822 (https://download.01.org/0day-ci/archive/20230823/202308230247.XxIH8PLy-lkp@xxxxxxxxx/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230823/202308230247.XxIH8PLy-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/202308230247.XxIH8PLy-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:12: warning: 'pdata' is used uninitialized in this function [-Wuninitialized]
133 | if (!pdata->slave_id) {
| ~~~~~^~~~~~~~~~


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