public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <yujie.liu@intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux ACPI <linux-acpi@vger.kernel.org>
Cc: <llvm@lists.linux.dev>, <kbuild-all@lists.01.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Mika Westerberg" <mika.westerberg@linux.intel.com>,
	Linux PCI <linux-pci@vger.kernel.org>
Subject: Re: [PATCH v1 2/3] ACPI: PM: Fix sharing of wakeup power resources
Date: Tue, 19 Oct 2021 15:29:02 +0800	[thread overview]
Message-ID: <347333dd-8e45-b454-a631-db2cdc436f2c@intel.com> (raw)
In-Reply-To: <202110171527.mOdEINNH-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 5962 bytes --]

Hi Rafael,

Thanks for your patch! Perhaps something to improve:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on linux/master linus/master v5.15-rc5 next-20211015]
[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-PM-Address-issues-related-to-managing-wakeup-power-resources/20211016-010527
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-c007-20211015 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6069a6a5049497a32a50a49661c2f4169078bdba)
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/5e93f177b80cbc9b9ee6ffc15ff9ad0ad23f2a7a
         git remote add linux-review https://github.com/0day-ci/linux
         git fetch --no-tags linux-review Rafael-J-Wysocki/ACPI-PM-Address-issues-related-to-managing-wakeup-power-resources/20211016-010527
         git checkout 5e93f177b80cbc9b9ee6ffc15ff9ad0ad23f2a7a
         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer

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


clang-analyzer warnings:

 >> drivers/acpi/power.c:739:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]
            return err;
            ^      ~~~
    drivers/acpi/power.c:712:2: note: 'err' declared without an initial value
            int err;
            ^~~~~~~
    drivers/acpi/power.c:714:6: note: Assuming 'dev' is non-null
            if (!dev || !dev->wakeup.flags.valid)
                ^~~~
    drivers/acpi/power.c:714:6: note: Left side of '||' is false
    drivers/acpi/power.c:714:14: note: Assuming field 'valid' is not equal to 0
            if (!dev || !dev->wakeup.flags.valid)
                        ^~~~~~~~~~~~~~~~~~~~~~~~
    drivers/acpi/power.c:714:2: note: Taking false branch
            if (!dev || !dev->wakeup.flags.valid)
            ^
    drivers/acpi/power.c:719:6: note: Assuming the condition is true
            if (dev->wakeup.prepare_count++)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/acpi/power.c:719:2: note: Taking true branch
            if (dev->wakeup.prepare_count++)
            ^
    drivers/acpi/power.c:720:3: note: Control jumps to line 738
                    goto out;
                    ^
    drivers/acpi/power.c:739:2: note: Undefined or garbage value returned to caller
            return err;
            ^      ~~~


vim +739 drivers/acpi/power.c

77e766099efc29 Rafael J. Wysocki 2008-07-07  703
^1da177e4c3f41 Linus Torvalds    2005-04-16  704  /*
^1da177e4c3f41 Linus Torvalds    2005-04-16  705   * Prepare a wakeup device, two steps (Ref ACPI 2.0:P229):
^1da177e4c3f41 Linus Torvalds    2005-04-16  706   * 1. Power on the power resources required for the wakeup device
77e766099efc29 Rafael J. Wysocki 2008-07-07  707   * 2. Execute _DSW (Device Sleep Wake) or (deprecated in ACPI 3.0) _PSW (Power
77e766099efc29 Rafael J. Wysocki 2008-07-07  708   *    State Wake) for the device, if present
^1da177e4c3f41 Linus Torvalds    2005-04-16  709   */
77e766099efc29 Rafael J. Wysocki 2008-07-07  710  int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state)
^1da177e4c3f41 Linus Torvalds    2005-04-16  711  {
5e93f177b80cbc Rafael J. Wysocki 2021-10-15  712  	int err;
^1da177e4c3f41 Linus Torvalds    2005-04-16  713
^1da177e4c3f41 Linus Torvalds    2005-04-16  714  	if (!dev || !dev->wakeup.flags.valid)
77e766099efc29 Rafael J. Wysocki 2008-07-07  715  		return -EINVAL;
^1da177e4c3f41 Linus Torvalds    2005-04-16  716
9b83ccd2f14f64 Rafael J. Wysocki 2009-09-08  717  	mutex_lock(&acpi_device_lock);
9b83ccd2f14f64 Rafael J. Wysocki 2009-09-08  718
9b83ccd2f14f64 Rafael J. Wysocki 2009-09-08  719  	if (dev->wakeup.prepare_count++)
9b83ccd2f14f64 Rafael J. Wysocki 2009-09-08  720  		goto out;
0af4b8c4fb3119 Rafael J. Wysocki 2008-07-07  721
5e93f177b80cbc Rafael J. Wysocki 2021-10-15  722  	err = acpi_power_on_list(&dev->wakeup.resources);
993cbe595dda73 Rafael J. Wysocki 2013-01-17  723  	if (err) {
5e93f177b80cbc Rafael J. Wysocki 2021-10-15  724  		dev_err(&dev->dev, "Cannot turn on wakeup power resources\n");
^1da177e4c3f41 Linus Torvalds    2005-04-16  725  		dev->wakeup.flags.valid = 0;
b5d667eb392ed9 Rafael J. Wysocki 2013-02-23  726  		goto out;
b5d667eb392ed9 Rafael J. Wysocki 2013-02-23  727  	}
5e93f177b80cbc Rafael J. Wysocki 2021-10-15  728
77e766099efc29 Rafael J. Wysocki 2008-07-07  729  	/*
993cbe595dda73 Rafael J. Wysocki 2013-01-17  730  	 * Passing 3 as the third argument below means the device may be
993cbe595dda73 Rafael J. Wysocki 2013-01-17  731  	 * put into arbitrary power state afterward.
77e766099efc29 Rafael J. Wysocki 2008-07-07  732  	 */
0af4b8c4fb3119 Rafael J. Wysocki 2008-07-07  733  	err = acpi_device_sleep_wake(dev, 1, sleep_state, 3);
9b83ccd2f14f64 Rafael J. Wysocki 2009-09-08  734  	if (err)
9b83ccd2f14f64 Rafael J. Wysocki 2009-09-08  735  		dev->wakeup.prepare_count = 0;
9b83ccd2f14f64 Rafael J. Wysocki 2009-09-08  736
9b83ccd2f14f64 Rafael J. Wysocki 2009-09-08  737   out:
9b83ccd2f14f64 Rafael J. Wysocki 2009-09-08  738  	mutex_unlock(&acpi_device_lock);
0af4b8c4fb3119 Rafael J. Wysocki 2008-07-07 @739  	return err;
^1da177e4c3f41 Linus Torvalds    2005-04-16  740  }
^1da177e4c3f41 Linus Torvalds    2005-04-16  741

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34215 bytes --]

       reply	other threads:[~2021-10-19  7:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <202110171527.mOdEINNH-lkp@intel.com>
2021-10-19  7:29 ` kernel test robot [this message]
2021-10-15 16:59 [PATCH v1 0/3] ACPI: PM: Address issues related to managing wakeup power resources Rafael J. Wysocki
2021-10-15 17:03 ` [PATCH v1 2/3] ACPI: PM: Fix sharing of " Rafael J. Wysocki
2021-10-15 20:31   ` kernel test robot
2021-10-19  7:25   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=347333dd-8e45-b454-a631-db2cdc436f2c@intel.com \
    --to=yujie.liu@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox