Re: [PATCH v5] ASoC: tas2781: Add tas2781 driver

From: kernel test robot
Date: Tue Mar 21 2023 - 20:53:28 EST


Hi Shenghao,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on linus/master v6.3-rc3 next-20230321]
[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/Shenghao-Ding/ASoC-tas2781-Add-tas2781-driver/20230321-193259
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link: https://lore.kernel.org/r/20230321113130.25853-1-13916275206%40139.com
patch subject: [PATCH v5] ASoC: tas2781: Add tas2781 driver
config: arm-randconfig-r046-20230320 (https://download.01.org/0day-ci/archive/20230322/202303220800.Pz99eL6X-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/intel-lab-lkp/linux/commit/a29d62a28a9077c66a962c69116c4eeb61f876f9
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Shenghao-Ding/ASoC-tas2781-Add-tas2781-driver/20230321-193259
git checkout a29d62a28a9077c66a962c69116c4eeb61f876f9
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash sound/soc/codecs/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202303220800.Pz99eL6X-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> sound/soc/codecs/tas2781-i2c.c:1608:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (i2c->dev.of_node)
^~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-i2c.c:1626:6: note: uninitialized use occurs here
if (ret < 0 && tas_dev != NULL)
^~~
sound/soc/codecs/tas2781-i2c.c:1608:2: note: remove the 'if' if its condition is always true
if (i2c->dev.of_node)
^~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-i2c.c:1580:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.
--
>> sound/soc/codecs/tas2781-dsp.c:1239:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (page == TAS2781_YRAM5_PAGE) {
^~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:1269:9: note: uninitialized use occurs here
return ret;
^~~
sound/soc/codecs/tas2781-dsp.c:1239:3: note: remove the 'if' if its condition is always true
if (page == TAS2781_YRAM5_PAGE) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:1210:14: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
} else if (page == TAS2781_YRAM3_PAGE) {
^~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:1269:9: note: uninitialized use occurs here
return ret;
^~~
sound/soc/codecs/tas2781-dsp.c:1210:10: note: remove the 'if' if its condition is always true
} else if (page == TAS2781_YRAM3_PAGE) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:1195:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
>> sound/soc/codecs/tas2781-dsp.c:2066:6: warning: variable 'prog_status' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (rca_conf_no > rca->ncfgs || rca_conf_no <= 0 ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2151:9: note: uninitialized use occurs here
return prog_status;
^~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2066:2: note: remove the 'if' if its condition is always false
if (rca_conf_no > rca->ncfgs || rca_conf_no <= 0 ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> sound/soc/codecs/tas2781-dsp.c:2066:6: warning: variable 'prog_status' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
if (rca_conf_no > rca->ncfgs || rca_conf_no <= 0 ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2151:9: note: uninitialized use occurs here
return prog_status;
^~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2066:6: note: remove the '||' if its condition is always false
if (rca_conf_no > rca->ncfgs || rca_conf_no <= 0 ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> sound/soc/codecs/tas2781-dsp.c:2066:6: warning: variable 'prog_status' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
if (rca_conf_no > rca->ncfgs || rca_conf_no <= 0 ||
^~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2151:9: note: uninitialized use occurs here
return prog_status;
^~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2066:6: note: remove the '||' if its condition is always false
if (rca_conf_no > rca->ncfgs || rca_conf_no <= 0 ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2059:6: warning: variable 'prog_status' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (prm_no >= tas_fmw->nr_programs) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2151:9: note: uninitialized use occurs here
return prog_status;
^~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2059:2: note: remove the 'if' if its condition is always false
if (prm_no >= tas_fmw->nr_programs) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2052:6: warning: variable 'prog_status' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (cfg_no >= tas_fmw->nr_configurations) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2151:9: note: uninitialized use occurs here
return prog_status;
^~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2052:2: note: remove the 'if' if its condition is always false
if (cfg_no >= tas_fmw->nr_configurations) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2047:6: warning: variable 'prog_status' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!tas_fmw) {
^~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2151:9: note: uninitialized use occurs here
return prog_status;
^~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2047:2: note: remove the 'if' if its condition is always false
if (!tas_fmw) {
^~~~~~~~~~~~~~~
sound/soc/codecs/tas2781-dsp.c:2045:17: note: initialize the variable 'prog_status' to silence this warning
int prog_status;
^
= 0
8 warnings generated.


vim +1608 sound/soc/codecs/tas2781-i2c.c

1576
1577 static int tasdevice_i2c_probe(struct i2c_client *i2c)
1578 {
1579 struct tasdevice_priv *tas_dev = NULL;
1580 int ret;
1581 const struct acpi_device_id *acpi_id;
1582 const struct i2c_device_id *id = i2c_match_id(tasdevice_id, i2c);
1583
1584 tas_dev = devm_kzalloc(&i2c->dev, sizeof(*tas_dev), GFP_KERNEL);
1585 if (!tas_dev) {
1586 ret = -ENOMEM;
1587 goto out;
1588 }
1589
1590 if (ACPI_HANDLE(&i2c->dev)) {
1591 acpi_id = acpi_match_device(i2c->dev.driver->acpi_match_table,
1592 &i2c->dev);
1593 if (!acpi_id) {
1594 dev_err(&i2c->dev, "No driver data\n");
1595 ret = -EINVAL;
1596 goto out;
1597 }
1598 tas_dev->chip_id = acpi_id->driver_data;
1599 tas_dev->isacpi = true;
1600 } else {
1601 tas_dev->chip_id = (id != NULL) ? id->driver_data : 0;
1602 tas_dev->isacpi = false;
1603 }
1604
1605 tas_dev->dev = &i2c->dev;
1606 tas_dev->client = (void *)i2c;
1607
> 1608 if (i2c->dev.of_node)
1609 ret = tasdevice_parse_dt(tas_dev);
1610 else {
1611 dev_err(tas_dev->dev, "No DTS info\n");
1612 goto out;
1613 }
1614
1615 tas_dev->regmap = devm_regmap_init_i2c(i2c,
1616 &tasdevice_regmap);
1617 if (IS_ERR(tas_dev->regmap)) {
1618 ret = PTR_ERR(tas_dev->regmap);
1619 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
1620 ret);
1621 goto out;
1622 }
1623 ret = tasdevice_init(tas_dev);
1624
1625 out:
1626 if (ret < 0 && tas_dev != NULL)
1627 tasdevice_remove(tas_dev);
1628 return ret;
1629

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