All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: drivers/opp/core.c:2516 _opp_set_required_dev() warn: passing positive error code '(-95)' to 'PTR_ERR'
Date: Tue, 18 Mar 2025 09:43:04 +0800	[thread overview]
Message-ID: <202503180951.Qi8Xbvog-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Ulf Hansson <ulf.hansson@linaro.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4701f33a10702d5fc577c32434eb62adde0a1ae1
commit: 0e8158b4a82eb5bfb69df17510d210b073896f00 OPP: Rework _set_required_devs() to manage a single device per call
date:   5 months ago
:::::: branch date: 27 hours ago
:::::: commit date: 5 months ago
config: openrisc-randconfig-r071-20250314 (https://download.01.org/0day-ci/archive/20250318/202503180951.Qi8Xbvog-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 14.2.0

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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202503180951.Qi8Xbvog-lkp@intel.com/

New smatch warnings:
drivers/opp/core.c:2516 _opp_set_required_dev() warn: passing positive error code '(-95)' to 'PTR_ERR'

Old smatch warnings:
drivers/opp/core.c:2958 _opp_set_availability() warn: passing positive error code '(-19)' to 'PTR_ERR'
drivers/opp/core.c:3034 dev_pm_opp_adjust_voltage() warn: passing positive error code '(-19)' to 'PTR_ERR'

vim +2516 drivers/opp/core.c

4f018bc0e1cfde Viresh Kumar 2018-06-26  2475  
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2476  static int _opp_set_required_dev(struct opp_table *opp_table,
e37440e7e2c276 Viresh Kumar 2023-10-27  2477  				 struct device *dev,
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2478  				 struct device *required_dev,
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2479  				 unsigned int index)
e37440e7e2c276 Viresh Kumar 2023-10-27  2480  {
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2481  	struct opp_table *required_table, *pd_table;
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2482  	struct device *gdev;
e37440e7e2c276 Viresh Kumar 2023-10-27  2483  
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2484  	/* Genpd core takes care of propagation to parent genpd */
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2485  	if (opp_table->is_genpd) {
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2486  		dev_err(dev, "%s: Operation not supported for genpds\n", __func__);
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2487  		return -EOPNOTSUPP;
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2488  	}
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2489  
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2490  	if (index >= opp_table->required_opp_count) {
e37440e7e2c276 Viresh Kumar 2023-10-27  2491  		dev_err(dev, "Required OPPs not available, can't set required devs\n");
e37440e7e2c276 Viresh Kumar 2023-10-27  2492  		return -EINVAL;
e37440e7e2c276 Viresh Kumar 2023-10-27  2493  	}
e37440e7e2c276 Viresh Kumar 2023-10-27  2494  
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2495  	required_table = opp_table->required_opp_tables[index];
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2496  	if (IS_ERR(required_table)) {
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2497  		dev_err(dev, "Missing OPP table, unable to set the required devs\n");
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2498  		return -ENODEV;
925141432fa4d8 Viresh Kumar 2023-11-16  2499  	}
925141432fa4d8 Viresh Kumar 2023-11-16  2500  
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2501  	/*
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2502  	 * The required_opp_tables parsing is not perfect, as the OPP core does
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2503  	 * the parsing solely based on the DT node pointers. The core sets the
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2504  	 * required_opp_tables entry to the first OPP table in the "opp_tables"
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2505  	 * list, that matches with the node pointer.
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2506  	 *
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2507  	 * If the target DT OPP table is used by multiple devices and they all
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2508  	 * create separate instances of 'struct opp_table' from it, then it is
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2509  	 * possible that the required_opp_tables entry may be set to the
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2510  	 * incorrect sibling device.
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2511  	 *
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2512  	 * Cross check it again and fix if required.
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2513  	 */
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2514  	gdev = dev_to_genpd_dev(required_dev);
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2515  	if (IS_ERR(gdev))
0e8158b4a82eb5 Ulf Hansson  2024-10-02 @2516  		return PTR_ERR(gdev);
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2517  
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2518  	pd_table = _find_opp_table(gdev);
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2519  	if (!IS_ERR(pd_table)) {
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2520  		if (pd_table != required_table) {
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2521  			dev_pm_opp_put_opp_table(required_table);
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2522  			opp_table->required_opp_tables[index] = pd_table;
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2523  		} else {
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2524  			dev_pm_opp_put_opp_table(pd_table);
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2525  		}
925141432fa4d8 Viresh Kumar 2023-11-16  2526  	}
e37440e7e2c276 Viresh Kumar 2023-10-27  2527  
0e8158b4a82eb5 Ulf Hansson  2024-10-02  2528  	opp_table->required_devs[index] = required_dev;
e37440e7e2c276 Viresh Kumar 2023-10-27  2529  	return 0;
e37440e7e2c276 Viresh Kumar 2023-10-27  2530  }
e37440e7e2c276 Viresh Kumar 2023-10-27  2531  

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

             reply	other threads:[~2025-03-18  1:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18  1:43 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-15 23:08 drivers/opp/core.c:2516 _opp_set_required_dev() warn: passing positive error code '(-95)' to 'PTR_ERR' 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=202503180951.Qi8Xbvog-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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.