[PATCH 5/6] powerpc/pseries: Add ibm,get-dynamic-sensor-state RTAS call support

Dan Carpenter dan.carpenter at linaro.org
Thu Jan 9 18:44:40 AEDT 2025


Hi Haren,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Haren-Myneni/powerpc-pseries-Define-common-functions-for-RTAS-sequence-HCALLs/20250105-045010
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link:    https://lore.kernel.org/r/20250104204652.388720-6-haren%40linux.ibm.com
patch subject: [PATCH 5/6] powerpc/pseries: Add ibm,get-dynamic-sensor-state RTAS call support
config: powerpc64-randconfig-r071-20250108 (https://download.01.org/0day-ci/archive/20250109/202501090552.UzEfb4QU-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 096551537b2a747a3387726ca618ceeb3950e9bc)

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 at intel.com>
| Reported-by: Dan Carpenter <dan.carpenter at linaro.org>
| Closes: https://lore.kernel.org/r/202501090552.UzEfb4QU-lkp@intel.com/

New smatch warnings:
arch/powerpc/platforms/pseries/papr-indices.c:496 papr_dynamic_sensor_ioc_get() warn: inconsistent returns 'global &rtas_ibm_get_dynamic_sensor_state_lock'.

Old smatch warnings:
arch/powerpc/platforms/pseries/papr-indices.c:438 papr_dynamic_indicator_ioc_set() warn: inconsistent returns 'global &rtas_ibm_set_dynamic_indicator_lock'.

vim +496 arch/powerpc/platforms/pseries/papr-indices.c

e44fb25ad9fa03 Haren Myneni 2025-01-04  452  static long papr_dynamic_sensor_ioc_get(struct papr_indices_io_block __user *ubuf)
e44fb25ad9fa03 Haren Myneni 2025-01-04  453  {
e44fb25ad9fa03 Haren Myneni 2025-01-04  454  	struct papr_indices_io_block kbuf;
e44fb25ad9fa03 Haren Myneni 2025-01-04  455  	struct rtas_work_area *work_area;
e44fb25ad9fa03 Haren Myneni 2025-01-04  456  	s32 fwrc, token, ret;
e44fb25ad9fa03 Haren Myneni 2025-01-04  457  	u32 rets;
e44fb25ad9fa03 Haren Myneni 2025-01-04  458  
e44fb25ad9fa03 Haren Myneni 2025-01-04  459  	token = rtas_function_token(RTAS_FN_IBM_GET_DYNAMIC_SENSOR_STATE);
e44fb25ad9fa03 Haren Myneni 2025-01-04  460  	if (token == RTAS_UNKNOWN_SERVICE)
e44fb25ad9fa03 Haren Myneni 2025-01-04  461  		return -ENOENT;
e44fb25ad9fa03 Haren Myneni 2025-01-04  462  
e44fb25ad9fa03 Haren Myneni 2025-01-04  463  	mutex_lock(&rtas_ibm_get_dynamic_sensor_state_lock);
e44fb25ad9fa03 Haren Myneni 2025-01-04  464  	work_area = papr_dynamic_indice_buf_from_user(ubuf, &kbuf);
e44fb25ad9fa03 Haren Myneni 2025-01-04  465  	if (IS_ERR(work_area))
e44fb25ad9fa03 Haren Myneni 2025-01-04  466  		return PTR_ERR(work_area);

Add an unlock, same as with the _set() function.

e44fb25ad9fa03 Haren Myneni 2025-01-04  467  
e44fb25ad9fa03 Haren Myneni 2025-01-04  468  	do {
e44fb25ad9fa03 Haren Myneni 2025-01-04  469  		fwrc = rtas_call(token, 2, 2, &rets,
e44fb25ad9fa03 Haren Myneni 2025-01-04  470  				kbuf.dynamic_param.token,
e44fb25ad9fa03 Haren Myneni 2025-01-04  471  				rtas_work_area_phys(work_area));
e44fb25ad9fa03 Haren Myneni 2025-01-04  472  	} while (rtas_busy_delay(fwrc));
e44fb25ad9fa03 Haren Myneni 2025-01-04  473  
e44fb25ad9fa03 Haren Myneni 2025-01-04  474  	rtas_work_area_free(work_area);
e44fb25ad9fa03 Haren Myneni 2025-01-04  475  	mutex_unlock(&rtas_ibm_get_dynamic_sensor_state_lock);
e44fb25ad9fa03 Haren Myneni 2025-01-04  476  
e44fb25ad9fa03 Haren Myneni 2025-01-04  477  	switch (fwrc) {
e44fb25ad9fa03 Haren Myneni 2025-01-04  478  	case RTAS_IBM_DYNAMIC_INDICE_SUCCESS:
e44fb25ad9fa03 Haren Myneni 2025-01-04  479  		if (put_user(rets, &ubuf->dynamic_param.state))
e44fb25ad9fa03 Haren Myneni 2025-01-04  480  			ret = -EFAULT;
e44fb25ad9fa03 Haren Myneni 2025-01-04  481  		else
e44fb25ad9fa03 Haren Myneni 2025-01-04  482  			ret = 0;
e44fb25ad9fa03 Haren Myneni 2025-01-04  483  		break;
e44fb25ad9fa03 Haren Myneni 2025-01-04  484  	case RTAS_IBM_DYNAMIC_INDICE_NO_INDICATOR:	/* No such indicator */
e44fb25ad9fa03 Haren Myneni 2025-01-04  485  		ret = -EOPNOTSUPP;
e44fb25ad9fa03 Haren Myneni 2025-01-04  486  		break;
e44fb25ad9fa03 Haren Myneni 2025-01-04  487  	default:
e44fb25ad9fa03 Haren Myneni 2025-01-04  488  		pr_err("unexpected ibm,get-dynamic-sensor result %d\n",
e44fb25ad9fa03 Haren Myneni 2025-01-04  489  				fwrc);
e44fb25ad9fa03 Haren Myneni 2025-01-04  490  		fallthrough;
e44fb25ad9fa03 Haren Myneni 2025-01-04  491  	case RTAS_IBM_DYNAMIC_INDICE_HW_ERROR:	/* Hardware/platform error */
e44fb25ad9fa03 Haren Myneni 2025-01-04  492  		ret = -EIO;
e44fb25ad9fa03 Haren Myneni 2025-01-04  493  		break;
e44fb25ad9fa03 Haren Myneni 2025-01-04  494  	}
e44fb25ad9fa03 Haren Myneni 2025-01-04  495  
e44fb25ad9fa03 Haren Myneni 2025-01-04 @496  	return ret;
e44fb25ad9fa03 Haren Myneni 2025-01-04  497  }

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



More information about the Linuxppc-dev mailing list