All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v4 22/28] clk: Stop forwarding clk_rate_requests to the parent
Date: Fri, 13 May 2022 20:04:36 +0800	[thread overview]
Message-ID: <202205131941.J8EMbNIW-lkp@intel.com> (raw)

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220512160412.1317123-23-maxime@cerno.tech>
References: <20220512160412.1317123-23-maxime@cerno.tech>
TO: Maxime Ripard <maxime@cerno.tech>
TO: Mike Turquette <mturquette@baylibre.com>
TO: Stephen Boyd <sboyd@kernel.org>
TO: linux-clk(a)vger.kernel.org
CC: Naresh Kamboju <naresh.kamboju@linaro.org>
CC: Alexander Stein <alexander.stein@ew.tq-group.com>
CC: Jerome Brunet <jbrunet@baylibre.com>
CC: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
CC: Marek Szyprowski <m.szyprowski@samsung.com>
CC: Yassine Oudjana <y.oudjana@protonmail.com>
CC: Tony Lindgren <tony@atomide.com>
CC: Neil Armstrong <narmstrong@baylibre.com>
CC: Maxime Ripard <maxime@cerno.tech>

Hi Maxime,

I love your patch! Perhaps something to improve:

[auto build test WARNING on clk/clk-next]
[also build test WARNING on linus/master v5.18-rc6 next-20220512]
[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/intel-lab-lkp/linux/commits/Maxime-Ripard/clk-More-clock-rate-fixes-and-tests/20220513-001815
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
:::::: branch date: 20 hours ago
:::::: commit date: 20 hours ago
config: riscv-randconfig-c006-20220512 (https://download.01.org/0day-ci/archive/20220513/202205131941.J8EMbNIW-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 9519dacab7b8afd537811fc2abaceb4d14f4e16a)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/intel-lab-lkp/linux/commit/2034099e179a2af8cd5752935973b61236748c0c
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Maxime-Ripard/clk-More-clock-rate-fixes-and-tests/20220513-001815
        git checkout 2034099e179a2af8cd5752935973b61236748c0c
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
                             ^
   drivers/clk/clk.c:1607:6: note: Assuming 'clk' is non-null
           if (!clk)
               ^~~~
   drivers/clk/clk.c:1607:2: note: Taking false branch
           if (!clk)
           ^
   drivers/clk/clk.c:1612:6: note: Assuming field 'exclusive_count' is 0
           if (clk->exclusive_count)
               ^~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1612:2: note: Taking false branch
           if (clk->exclusive_count)
           ^
   drivers/clk/clk.c:1617:8: note: Calling 'clk_core_round_rate_nolock'
           ret = clk_core_round_rate_nolock(clk->core, &req);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1517:2: note: Assuming 'debug_locks' is 0
           lockdep_assert_held(&prepare_lock);
           ^
   include/linux/lockdep.h:316:2: note: expanded from macro 'lockdep_assert_held'
           lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/lockdep.h:310:15: note: expanded from macro 'lockdep_assert'
           do { WARN_ON(debug_locks && !(cond)); } while (0)
                        ^~~~~~~~~~~
   include/asm-generic/bug.h:166:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   drivers/clk/clk.c:1517:2: note: Left side of '&&' is false
           lockdep_assert_held(&prepare_lock);
           ^
   include/linux/lockdep.h:316:2: note: expanded from macro 'lockdep_assert_held'
           lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
           ^
   include/linux/lockdep.h:310:27: note: expanded from macro 'lockdep_assert'
           do { WARN_ON(debug_locks && !(cond)); } while (0)
                                    ^
   drivers/clk/clk.c:1517:2: note: Loop condition is false.  Exiting loop
           lockdep_assert_held(&prepare_lock);
           ^
   include/linux/lockdep.h:316:2: note: expanded from macro 'lockdep_assert_held'
           lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
           ^
   include/linux/lockdep.h:310:2: note: expanded from macro 'lockdep_assert'
           do { WARN_ON(debug_locks && !(cond)); } while (0)
           ^
   drivers/clk/clk.c:1519:7: note: 'core' is non-null
           if (!core) {
                ^~~~
   drivers/clk/clk.c:1519:2: note: Taking false branch
           if (!core) {
           ^
   drivers/clk/clk.c:1524:6: note: Assuming the condition is false
           if (clk_core_can_round(core))
               ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1524:2: note: Taking false branch
           if (clk_core_can_round(core))
           ^
   drivers/clk/clk.c:1527:6: note: Assuming the condition is true
           if (core->flags & CLK_SET_RATE_PARENT) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1527:2: note: Taking true branch
           if (core->flags & CLK_SET_RATE_PARENT) {
           ^
   drivers/clk/clk.c:1530:3: note: Calling 'clk_core_forward_rate_req'
                   clk_core_forward_rate_req(core, req, core->parent, &parent_req, req->rate);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:573:14: note: Assuming the condition is false
           if (WARN_ON(!clk_core_has_parent(core, parent)))
                       ^
   include/asm-generic/bug.h:166:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   drivers/clk/clk.c:573:2: note: Taking false branch
           if (WARN_ON(!clk_core_has_parent(core, parent)))
           ^
   drivers/clk/clk.c:576:2: note: Calling 'clk_core_init_rate_req'
           clk_core_init_rate_req(parent, req, parent_rate);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1446:15: note: 'core' is null
           if (WARN_ON(!core || !req))
                        ^
   include/asm-generic/bug.h:166:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   drivers/clk/clk.c:1446:20: note: Left side of '||' is true
           if (WARN_ON(!core || !req))
                             ^
   drivers/clk/clk.c:1446:2: note: Taking true branch
           if (WARN_ON(!core || !req))
           ^
   drivers/clk/clk.c:1447:3: note: Returning without writing to 'req->min_rate'
                   return;
                   ^
   drivers/clk/clk.c:576:2: note: Returning from 'clk_core_init_rate_req'
           clk_core_init_rate_req(parent, req, parent_rate);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:578:20: note: The left operand of '<' is a garbage value
           if (req->min_rate < old_req->min_rate)
               ~~~~~~~~~~~~~ ^
>> drivers/clk/clk.c:1410:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
           if (!req->min_rate && !req->max_rate)
               ^
   drivers/clk/clk.c:1607:6: note: Assuming 'clk' is non-null
           if (!clk)
               ^~~~
   drivers/clk/clk.c:1607:2: note: Taking false branch
           if (!clk)
           ^
   drivers/clk/clk.c:1612:6: note: Assuming field 'exclusive_count' is 0
           if (clk->exclusive_count)
               ^~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1612:2: note: Taking false branch
           if (clk->exclusive_count)
           ^
   drivers/clk/clk.c:1615:2: note: Calling 'clk_core_init_rate_req'
           clk_core_init_rate_req(clk->core, &req, rate);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1446:14: note: Assuming 'core' is non-null
           if (WARN_ON(!core || !req))
                       ^
   include/asm-generic/bug.h:166:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   drivers/clk/clk.c:1446:14: note: Left side of '||' is false
           if (WARN_ON(!core || !req))
                       ^
   drivers/clk/clk.c:1446:2: note: Taking false branch
           if (WARN_ON(!core || !req))
           ^
   drivers/clk/clk.c:1453:6: note: Assuming 'parent' is null
           if (parent) {
               ^~~~~~
   drivers/clk/clk.c:1453:2: note: Taking false branch
           if (parent) {
           ^
   drivers/clk/clk.c:1615:2: note: Returning from 'clk_core_init_rate_req'
           clk_core_init_rate_req(clk->core, &req, rate);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1617:8: note: Calling 'clk_core_round_rate_nolock'
           ret = clk_core_round_rate_nolock(clk->core, &req);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1517:2: note: Assuming 'debug_locks' is 0
           lockdep_assert_held(&prepare_lock);
           ^
   include/linux/lockdep.h:316:2: note: expanded from macro 'lockdep_assert_held'
           lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/lockdep.h:310:15: note: expanded from macro 'lockdep_assert'
           do { WARN_ON(debug_locks && !(cond)); } while (0)
                        ^~~~~~~~~~~
   include/asm-generic/bug.h:166:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   drivers/clk/clk.c:1517:2: note: Left side of '&&' is false
           lockdep_assert_held(&prepare_lock);
           ^
   include/linux/lockdep.h:316:2: note: expanded from macro 'lockdep_assert_held'
           lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
           ^
   include/linux/lockdep.h:310:27: note: expanded from macro 'lockdep_assert'
           do { WARN_ON(debug_locks && !(cond)); } while (0)
                                    ^
   drivers/clk/clk.c:1517:2: note: Loop condition is false.  Exiting loop
           lockdep_assert_held(&prepare_lock);
           ^
   include/linux/lockdep.h:316:2: note: expanded from macro 'lockdep_assert_held'
           lockdep_assert(lockdep_is_held(l) != LOCK_STATE_NOT_HELD)
           ^
   include/linux/lockdep.h:310:2: note: expanded from macro 'lockdep_assert'
           do { WARN_ON(debug_locks && !(cond)); } while (0)
           ^
   drivers/clk/clk.c:1519:7: note: 'core' is non-null
           if (!core) {
                ^~~~
   drivers/clk/clk.c:1519:2: note: Taking false branch
           if (!core) {
           ^
   drivers/clk/clk.c:1524:6: note: Calling 'clk_core_can_round'
           if (clk_core_can_round(core))
               ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1509:9: note: Assuming field 'determine_rate' is null
           return core->ops->determine_rate || core->ops->round_rate;
                  ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1509:9: note: Left side of '||' is false
   drivers/clk/clk.c:1509:2: note: Returning without writing to 'core->parent', which participates in a condition later
           return core->ops->determine_rate || core->ops->round_rate;
           ^
   drivers/clk/clk.c:1524:6: note: Returning from 'clk_core_can_round'
           if (clk_core_can_round(core))
               ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1524:6: note: Assuming the condition is false
           if (clk_core_can_round(core))
               ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1524:2: note: Taking false branch
           if (clk_core_can_round(core))
           ^
   drivers/clk/clk.c:1527:6: note: Assuming the condition is true
           if (core->flags & CLK_SET_RATE_PARENT) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1527:2: note: Taking true branch

vim +1410 drivers/clk/clk.c

7ec986efed0208 Dong Aisheng       2016-06-30  1391  
0f6cc2b8e94da5 Jerome Brunet      2017-12-01  1392  static int clk_core_determine_round_nolock(struct clk_core *core,
0817b62cc037a5 Boris Brezillon    2015-07-07  1393  					   struct clk_rate_request *req)
b2476490ef1113 Mike Turquette     2012-03-15  1394  {
0817b62cc037a5 Boris Brezillon    2015-07-07  1395  	long rate;
4dff95dc9477a3 Stephen Boyd       2015-04-30  1396  
4dff95dc9477a3 Stephen Boyd       2015-04-30  1397  	lockdep_assert_held(&prepare_lock);
b2476490ef1113 Mike Turquette     2012-03-15  1398  
d6968fca789700 Stephen Boyd       2015-04-30  1399  	if (!core)
4dff95dc9477a3 Stephen Boyd       2015-04-30  1400  		return 0;
b2476490ef1113 Mike Turquette     2012-03-15  1401  
8f3363af8a3536 Maxime Ripard      2022-05-12  1402  	/*
8f3363af8a3536 Maxime Ripard      2022-05-12  1403  	 * Some clock providers hand-craft their clk_rate_requests and
8f3363af8a3536 Maxime Ripard      2022-05-12  1404  	 * might not fill min_rate and max_rate.
8f3363af8a3536 Maxime Ripard      2022-05-12  1405  	 *
8f3363af8a3536 Maxime Ripard      2022-05-12  1406  	 * If it's the case, clamping the rate is equivalent to setting
8f3363af8a3536 Maxime Ripard      2022-05-12  1407  	 * the rate to 0 which is bad. Skip the clamping but complain so
8f3363af8a3536 Maxime Ripard      2022-05-12  1408  	 * that it gets fixed, hopefully.
8f3363af8a3536 Maxime Ripard      2022-05-12  1409  	 */
8f3363af8a3536 Maxime Ripard      2022-05-12 @1410  	if (!req->min_rate && !req->max_rate)
8f3363af8a3536 Maxime Ripard      2022-05-12  1411  		pr_warn("%s: %s: clk_rate_request has initialized min or max rate.\n",
8f3363af8a3536 Maxime Ripard      2022-05-12  1412  			__func__, core->name);
8f3363af8a3536 Maxime Ripard      2022-05-12  1413  	else
948fb0969eae85 Maxime Ripard      2022-02-25  1414  		req->rate = clamp(req->rate, req->min_rate, req->max_rate);
948fb0969eae85 Maxime Ripard      2022-02-25  1415  
55e9b8b7b806ec Jerome Brunet      2017-12-01  1416  	/*
e27453adcadd7b Geert Uytterhoeven 2021-03-26  1417  	 * At this point, core protection will be disabled
55e9b8b7b806ec Jerome Brunet      2017-12-01  1418  	 * - if the provider is not protected at all
55e9b8b7b806ec Jerome Brunet      2017-12-01  1419  	 * - if the calling consumer is the only one which has exclusivity
55e9b8b7b806ec Jerome Brunet      2017-12-01  1420  	 *   over the provider
55e9b8b7b806ec Jerome Brunet      2017-12-01  1421  	 */
e55a839a7a1c56 Jerome Brunet      2017-12-01  1422  	if (clk_core_rate_is_protected(core)) {
e55a839a7a1c56 Jerome Brunet      2017-12-01  1423  		req->rate = core->rate;
e55a839a7a1c56 Jerome Brunet      2017-12-01  1424  	} else if (core->ops->determine_rate) {
0817b62cc037a5 Boris Brezillon    2015-07-07  1425  		return core->ops->determine_rate(core->hw, req);
0817b62cc037a5 Boris Brezillon    2015-07-07  1426  	} else if (core->ops->round_rate) {
0817b62cc037a5 Boris Brezillon    2015-07-07  1427  		rate = core->ops->round_rate(core->hw, req->rate,
0817b62cc037a5 Boris Brezillon    2015-07-07  1428  					     &req->best_parent_rate);
0817b62cc037a5 Boris Brezillon    2015-07-07  1429  		if (rate < 0)
0817b62cc037a5 Boris Brezillon    2015-07-07  1430  			return rate;
0817b62cc037a5 Boris Brezillon    2015-07-07  1431  
0817b62cc037a5 Boris Brezillon    2015-07-07  1432  		req->rate = rate;
0817b62cc037a5 Boris Brezillon    2015-07-07  1433  	} else {
0f6cc2b8e94da5 Jerome Brunet      2017-12-01  1434  		return -EINVAL;
0f6cc2b8e94da5 Jerome Brunet      2017-12-01  1435  	}
0f6cc2b8e94da5 Jerome Brunet      2017-12-01  1436  
0f6cc2b8e94da5 Jerome Brunet      2017-12-01  1437  	return 0;
0f6cc2b8e94da5 Jerome Brunet      2017-12-01  1438  }
0f6cc2b8e94da5 Jerome Brunet      2017-12-01  1439  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

             reply	other threads:[~2022-05-13 12:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 12:04 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-05-12 16:03 [PATCH v4 00/28] clk: More clock rate fixes and tests Maxime Ripard
2022-05-12 16:04 ` [PATCH v4 22/28] clk: Stop forwarding clk_rate_requests to the parent Maxime Ripard
2022-05-14  2:12   ` 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=202205131941.J8EMbNIW-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.