All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/opp/core.c:2516 _opp_set_required_dev() warn: passing positive error code '(-95)' to 'PTR_ERR'
@ 2025-03-15 23:08 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-03-15 23:08 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

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:   eb88e6bfbc0a975e08a18c39d1138d3e6cdc00a5
commit: 0e8158b4a82eb5bfb69df17510d210b073896f00 OPP: Rework _set_required_devs() to manage a single device per call
date:   5 months ago
:::::: branch date: 4 hours ago
:::::: commit date: 5 months ago
config: openrisc-randconfig-r071-20250314 (https://download.01.org/0day-ci/archive/20250316/202503160619.wZwaRC05-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/202503160619.wZwaRC05-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

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

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* drivers/opp/core.c:2516 _opp_set_required_dev() warn: passing positive error code '(-95)' to 'PTR_ERR'
@ 2025-03-18  1:43 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-03-18  1:43 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-18  1:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-18  1:43 drivers/opp/core.c:2516 _opp_set_required_dev() warn: passing positive error code '(-95)' to 'PTR_ERR' kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2025-03-15 23:08 kernel test robot

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.