drivers/hwmon/xgene-hwmon.c:538:13: sparse: sparse: incorrect type in assignment (different address spaces)

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   fce2dfa773ced15f27dd27cd0b482a7473cdcf2a
commit: 80fcd1e7f5c7009fa1c64737df100cc304c19c1f hwmon: (xgene-hwmon) Simplify PCC shared memory region handling
date:   1 year, 3 months ago
config: i386-randconfig-063-20260717 (https://download.01.org/0day-ci/archive/20260717/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260717/[email protected]/reproduce)

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
| Fixes: 80fcd1e7f5c7 ("hwmon: (xgene-hwmon) Simplify PCC shared memory region handling")
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
   drivers/hwmon/xgene-hwmon.c:116:15: sparse: sparse: cast to restricted __le16
   drivers/hwmon/xgene-hwmon.c:119:9: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short volatile @@     got restricted __le16 [usertype] @@
   drivers/hwmon/xgene-hwmon.c:119:9: sparse:     expected unsigned short volatile
   drivers/hwmon/xgene-hwmon.c:119:9: sparse:     got restricted __le16 [usertype]
   drivers/hwmon/xgene-hwmon.c:128:21: sparse: sparse: cast removes address space '__iomem' of expression
   drivers/hwmon/xgene-hwmon.c:137:9: sparse: sparse: cast removes address space '__iomem' of expression
   drivers/hwmon/xgene-hwmon.c:137:9: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int volatile @@     got restricted __le32 [usertype] @@
   drivers/hwmon/xgene-hwmon.c:137:9: sparse:     expected unsigned int volatile
   drivers/hwmon/xgene-hwmon.c:137:9: sparse:     got restricted __le32 [usertype]
   drivers/hwmon/xgene-hwmon.c:141:9: sparse: sparse: cast removes address space '__iomem' of expression
   drivers/hwmon/xgene-hwmon.c:141:9: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short volatile @@     got restricted __le16 [usertype] @@
   drivers/hwmon/xgene-hwmon.c:141:9: sparse:     expected unsigned short volatile
   drivers/hwmon/xgene-hwmon.c:141:9: sparse:     got restricted __le16 [usertype]
   drivers/hwmon/xgene-hwmon.c:145:15: sparse: sparse: cast removes address space '__iomem' of expression
   drivers/hwmon/xgene-hwmon.c:145:15: sparse: sparse: cast to restricted __le16
   drivers/hwmon/xgene-hwmon.c:147:9: sparse: sparse: cast removes address space '__iomem' of expression
   drivers/hwmon/xgene-hwmon.c:147:9: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short volatile @@     got restricted __le16 [usertype] @@
   drivers/hwmon/xgene-hwmon.c:147:9: sparse:     expected unsigned short volatile
   drivers/hwmon/xgene-hwmon.c:147:9: sparse:     got restricted __le16 [usertype]
   drivers/hwmon/xgene-hwmon.c:151:17: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int volatile @@     got restricted __le32 [usertype] @@
   drivers/hwmon/xgene-hwmon.c:151:17: sparse:     expected unsigned int volatile
   drivers/hwmon/xgene-hwmon.c:151:17: sparse:     got restricted __le32 [usertype]
>> drivers/hwmon/xgene-hwmon.c:538:13: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *msg @@     got struct acpi_pcct_shared_memory [noderef] __iomem * @@
   drivers/hwmon/xgene-hwmon.c:538:13: sparse:     expected void *msg
   drivers/hwmon/xgene-hwmon.c:538:13: sparse:     got struct acpi_pcct_shared_memory [noderef] __iomem *
   drivers/hwmon/xgene-hwmon.c:540:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned short [usertype] *addr @@     got unsigned short [noderef] __iomem * @@
   drivers/hwmon/xgene-hwmon.c:540:38: sparse:     expected unsigned short [usertype] *addr
   drivers/hwmon/xgene-hwmon.c:540:38: sparse:     got unsigned short [noderef] __iomem *
   drivers/hwmon/xgene-hwmon.c:562:45: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned short [usertype] *addr @@     got unsigned short [noderef] __iomem * @@
   drivers/hwmon/xgene-hwmon.c:562:45: sparse:     expected unsigned short [usertype] *addr
   drivers/hwmon/xgene-hwmon.c:562:45: sparse:     got unsigned short [noderef] __iomem *

vim +538 drivers/hwmon/xgene-hwmon.c

ed42cfa881e1d8 hotran       2016-07-21  518  
ed42cfa881e1d8 hotran       2016-07-21  519  /*
ed42cfa881e1d8 hotran       2016-07-21  520   * This function is called when the PCC Mailbox received a message
ed42cfa881e1d8 hotran       2016-07-21  521   */
ed42cfa881e1d8 hotran       2016-07-21  522  static void xgene_hwmon_pcc_rx_cb(struct mbox_client *cl, void *msg)
ed42cfa881e1d8 hotran       2016-07-21  523  {
ed42cfa881e1d8 hotran       2016-07-21  524  	struct xgene_hwmon_dev *ctx = to_xgene_hwmon_dev(cl);
80fcd1e7f5c700 Sudeep Holla 2025-04-11  525  	struct acpi_pcct_shared_memory __iomem *generic_comm_base =
80fcd1e7f5c700 Sudeep Holla 2025-04-11  526  							ctx->pcc_chan->shmem;
ed42cfa881e1d8 hotran       2016-07-21  527  	struct slimpro_resp_msg amsg;
ed42cfa881e1d8 hotran       2016-07-21  528  
2ca492e22cb70a hotran       2016-09-08  529  	/*
2ca492e22cb70a hotran       2016-09-08  530  	 * While the driver registers with the mailbox framework, an interrupt
2ca492e22cb70a hotran       2016-09-08  531  	 * can be pending before the probe function completes its
2ca492e22cb70a hotran       2016-09-08  532  	 * initialization. If such condition occurs, just queue up the message
2ca492e22cb70a hotran       2016-09-08  533  	 * as the driver is not ready for servicing the callback.
2ca492e22cb70a hotran       2016-09-08  534  	 */
2ca492e22cb70a hotran       2016-09-08  535  	if (xgene_hwmon_rx_ready(ctx, &amsg) < 0)
2ca492e22cb70a hotran       2016-09-08  536  		return;
2ca492e22cb70a hotran       2016-09-08  537  
ed42cfa881e1d8 hotran       2016-07-21 @538  	msg = generic_comm_base + 1;
ed42cfa881e1d8 hotran       2016-07-21  539  	/* Check if platform sends interrupt */
ed42cfa881e1d8 hotran       2016-07-21  540  	if (!xgene_word_tst_and_clr(&generic_comm_base->status,
2cf39b806be746 Sudeep Holla 2023-09-27  541  				    PCC_STATUS_SCI_DOORBELL))
ed42cfa881e1d8 hotran       2016-07-21  542  		return;
ed42cfa881e1d8 hotran       2016-07-21  543  
ed42cfa881e1d8 hotran       2016-07-21  544  	/*
ed42cfa881e1d8 hotran       2016-07-21  545  	 * Response message format:
ed42cfa881e1d8 hotran       2016-07-21  546  	 * msg[0] is the return code of the operation
ed42cfa881e1d8 hotran       2016-07-21  547  	 * msg[1] is the first parameter word
ed42cfa881e1d8 hotran       2016-07-21  548  	 * msg[2] is the second parameter word
ed42cfa881e1d8 hotran       2016-07-21  549  	 *
ed42cfa881e1d8 hotran       2016-07-21  550  	 * As message only supports dword size, just assign it.
ed42cfa881e1d8 hotran       2016-07-21  551  	 */
ed42cfa881e1d8 hotran       2016-07-21  552  
ed42cfa881e1d8 hotran       2016-07-21  553  	/* Check for sync query */
ed42cfa881e1d8 hotran       2016-07-21  554  	if (ctx->resp_pending &&
ed42cfa881e1d8 hotran       2016-07-21  555  	    ((MSG_TYPE(((u32 *)msg)[0]) == MSG_TYPE_ERR) ||
ed42cfa881e1d8 hotran       2016-07-21  556  	     (MSG_TYPE(((u32 *)msg)[0]) == MSG_TYPE_DBG &&
ed42cfa881e1d8 hotran       2016-07-21  557  	      MSG_SUBTYPE(((u32 *)msg)[0]) == DBG_SUBTYPE_SENSOR_READ) ||
ed42cfa881e1d8 hotran       2016-07-21  558  	     (MSG_TYPE(((u32 *)msg)[0]) == MSG_TYPE_PWRMGMT &&
ed42cfa881e1d8 hotran       2016-07-21  559  	      MSG_SUBTYPE(((u32 *)msg)[0]) == PWRMGMT_SUBTYPE_TPC &&
ed42cfa881e1d8 hotran       2016-07-21  560  	      TPC_CMD(((u32 *)msg)[0]) == TPC_ALARM))) {
ed42cfa881e1d8 hotran       2016-07-21  561  		/* Check if platform completes command */
ed42cfa881e1d8 hotran       2016-07-21  562  		if (xgene_word_tst_and_clr(&generic_comm_base->status,
2cf39b806be746 Sudeep Holla 2023-09-27  563  					   PCC_STATUS_CMD_COMPLETE)) {
ed42cfa881e1d8 hotran       2016-07-21  564  			ctx->sync_msg.msg = ((u32 *)msg)[0];
ed42cfa881e1d8 hotran       2016-07-21  565  			ctx->sync_msg.param1 = ((u32 *)msg)[1];
ed42cfa881e1d8 hotran       2016-07-21  566  			ctx->sync_msg.param2 = ((u32 *)msg)[2];
ed42cfa881e1d8 hotran       2016-07-21  567  
ed42cfa881e1d8 hotran       2016-07-21  568  			/* Operation waiting for response */
ed42cfa881e1d8 hotran       2016-07-21  569  			complete(&ctx->rd_complete);
ed42cfa881e1d8 hotran       2016-07-21  570  
ed42cfa881e1d8 hotran       2016-07-21  571  			return;
ed42cfa881e1d8 hotran       2016-07-21  572  		}
ed42cfa881e1d8 hotran       2016-07-21  573  	}
ed42cfa881e1d8 hotran       2016-07-21  574  
ed42cfa881e1d8 hotran       2016-07-21  575  	/*
ed42cfa881e1d8 hotran       2016-07-21  576  	 * Platform notifies interrupt to OSPM.
ed42cfa881e1d8 hotran       2016-07-21  577  	 * OPSM schedules a consumer command to get this information
ed42cfa881e1d8 hotran       2016-07-21  578  	 * in a workqueue. Platform must wait until OSPM has issued
ed42cfa881e1d8 hotran       2016-07-21  579  	 * a consumer command that serves this notification.
ed42cfa881e1d8 hotran       2016-07-21  580  	 */
ed42cfa881e1d8 hotran       2016-07-21  581  
ed42cfa881e1d8 hotran       2016-07-21  582  	/* Enqueue to the FIFO */
ed42cfa881e1d8 hotran       2016-07-21  583  	kfifo_in_spinlocked(&ctx->async_msg_fifo, &amsg,
ed42cfa881e1d8 hotran       2016-07-21  584  			    sizeof(struct slimpro_resp_msg), &ctx->kfifo_lock);
ed42cfa881e1d8 hotran       2016-07-21  585  	/* Schedule the bottom handler */
ed42cfa881e1d8 hotran       2016-07-21  586  	schedule_work(&ctx->workq);
ed42cfa881e1d8 hotran       2016-07-21  587  }
ed42cfa881e1d8 hotran       2016-07-21  588  

:::::: The code at line 538 was first introduced by commit
:::::: ed42cfa881e1d8d9603b7cb872199e3c8e0d1b19 hwmon: Add xgene hwmon driver

:::::: TO: hotran <[email protected]>
:::::: CC: Guenter Roeck <[email protected]>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.