Re: [PATCH] ACPI: LPSS: Use ACPI_COMPANION() directly

From: kernel test robot
Date: Sat Oct 09 2021 - 14:36:01 EST


Hi "Rafael,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on v5.15-rc4 next-20211008]
[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/Rafael-J-Wysocki/ACPI-LPSS-Use-ACPI_COMPANION-directly/20211009-222505
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: i386-randconfig-a013-20211009 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 30caca39f401ae17927439c0a0bd6d1b1916dd6a)
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/0day-ci/linux/commit/6fd0aa7da4af33b790cf8e5a943fe2795a8f215a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Rafael-J-Wysocki/ACPI-LPSS-Use-ACPI_COMPANION-directly/20211009-222505
git checkout 6fd0aa7da4af33b790cf8e5a943fe2795a8f215a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386

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/acpi/acpi_lpss.c:729:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (WARN_ON(!pdata || !pdata->mmio_base)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/bug.h:120:28: note: expanded from macro 'WARN_ON'
#define WARN_ON(condition) ({ \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/acpi_lpss.c:737:9: note: uninitialized use occurs here
return ret;
^~~
drivers/acpi/acpi_lpss.c:729:2: note: remove the 'if' if its condition is always true
if (WARN_ON(!pdata || !pdata->mmio_base)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/acpi_lpss.c:718:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.


vim +729 drivers/acpi/acpi_lpss.c

1a8f83515c1646 Rafael J. Wysocki 2014-02-11 712
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 713 static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val)
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 714 {
6fd0aa7da4af33 Rafael J. Wysocki 2021-10-09 715 struct acpi_device *adev = ACPI_COMPANION(dev);
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 716 struct lpss_private_data *pdata;
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 717 unsigned long flags;
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 718 int ret;
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 719
6fd0aa7da4af33 Rafael J. Wysocki 2021-10-09 720 if (WARN_ON(!adev))
6fd0aa7da4af33 Rafael J. Wysocki 2021-10-09 721 return -ENODEV;
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 722
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 723 spin_lock_irqsave(&dev->power.lock, flags);
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 724 if (pm_runtime_suspended(dev)) {
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 725 ret = -EAGAIN;
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 726 goto out;
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 727 }
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 728 pdata = acpi_driver_data(adev);
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 @729 if (WARN_ON(!pdata || !pdata->mmio_base)) {
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 730 ret = -ENODEV;
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 731 goto out;
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 732 }
1a8f83515c1646 Rafael J. Wysocki 2014-02-11 733 *val = __lpss_reg_read(pdata, reg);
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 734
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 735 out:
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 736 spin_unlock_irqrestore(&dev->power.lock, flags);
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 737 return ret;
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 738 }
2e0f8822d1a6d8 Rafael J. Wysocki 2013-03-06 739

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

Attachment: .config.gz
Description: application/gzip