[Intel-gfx] [drm-intel:for-linux-next-gt 1/1] drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c:497 intel_guc_slpc_set_min_freq() warn: inconsistent returns '&slpc->lock'.

Dan Carpenter dan.carpenter at oracle.com
Tue Aug 30 14:13:26 UTC 2022


tree:   git://anongit.freedesktop.org/drm-intel for-linux-next-gt
head:   f54e515c91806288126f64b37da0c78baa2d8c1f
commit: 95ccf312a1e4f5a1150dd1a0a2d81c1043e33fb6 [1/1] drm/i915/guc/slpc: Allow SLPC to use efficient frequency
config: i386-randconfig-m021-20220829 (https://download.01.org/0day-ci/archive/20220830/202208301957.uLAOt2oy-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp at intel.com>
Reported-by: Dan Carpenter <dan.carpenter at oracle.com>

New smatch warnings:
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c:497 intel_guc_slpc_set_min_freq() warn: inconsistent returns '&slpc->lock'.

vim +497 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c

d41f6f82d319ca Vinay Belgaumkar 2021-07-30  457  int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val)
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  458  {
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  459  	struct drm_i915_private *i915 = slpc_to_i915(slpc);
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  460  	intel_wakeref_t wakeref;
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  461  	int ret;
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  462  
025cb07bebfaf9 Vinay Belgaumkar 2021-07-30  463  	if (val < slpc->min_freq ||
025cb07bebfaf9 Vinay Belgaumkar 2021-07-30  464  	    val > slpc->rp0_freq ||
025cb07bebfaf9 Vinay Belgaumkar 2021-07-30  465  	    val > slpc->max_freq_softlimit)
025cb07bebfaf9 Vinay Belgaumkar 2021-07-30  466  		return -EINVAL;
025cb07bebfaf9 Vinay Belgaumkar 2021-07-30  467  
493043feed006f Vinay Belgaumkar 2021-11-01  468  	/* Need a lock now since waitboost can be modifying min as well */
493043feed006f Vinay Belgaumkar 2021-11-01  469  	mutex_lock(&slpc->lock);
493043feed006f Vinay Belgaumkar 2021-11-01  470  
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  471  	with_intel_runtime_pm(&i915->runtime_pm, wakeref) {
493043feed006f Vinay Belgaumkar 2021-11-01  472  
95ccf312a1e4f5 Vinay Belgaumkar 2022-08-19  473  		/* Ignore efficient freq if lower min freq is requested */
95ccf312a1e4f5 Vinay Belgaumkar 2022-08-19  474  		ret = slpc_set_param(slpc,
95ccf312a1e4f5 Vinay Belgaumkar 2022-08-19  475  				     SLPC_PARAM_IGNORE_EFFICIENT_FREQUENCY,
95ccf312a1e4f5 Vinay Belgaumkar 2022-08-19  476  				     val < slpc->rp1_freq);
95ccf312a1e4f5 Vinay Belgaumkar 2022-08-19  477  		if (unlikely(ret)) {
95ccf312a1e4f5 Vinay Belgaumkar 2022-08-19  478  			i915_probe_error(i915, "Failed to toggle efficient freq (%pe)\n",
95ccf312a1e4f5 Vinay Belgaumkar 2022-08-19  479  					 ERR_PTR(ret));
95ccf312a1e4f5 Vinay Belgaumkar 2022-08-19  480  			return ret;

mutex_unlock(&slpc->lock); before returning

95ccf312a1e4f5 Vinay Belgaumkar 2022-08-19  481  		}
95ccf312a1e4f5 Vinay Belgaumkar 2022-08-19  482  
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  483  		ret = slpc_set_param(slpc,
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  484  				     SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ,
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  485  				     val);
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  486  
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  487  		/* Return standardized err code for sysfs calls */
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  488  		if (ret)
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  489  			ret = -EIO;
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  490  	}
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  491  
025cb07bebfaf9 Vinay Belgaumkar 2021-07-30  492  	if (!ret)
025cb07bebfaf9 Vinay Belgaumkar 2021-07-30  493  		slpc->min_freq_softlimit = val;
025cb07bebfaf9 Vinay Belgaumkar 2021-07-30  494  
493043feed006f Vinay Belgaumkar 2021-11-01  495  	mutex_unlock(&slpc->lock);
493043feed006f Vinay Belgaumkar 2021-11-01  496  
d41f6f82d319ca Vinay Belgaumkar 2021-07-30 @497  	return ret;
d41f6f82d319ca Vinay Belgaumkar 2021-07-30  498  }

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



More information about the Intel-gfx mailing list