Skip to contentSkip to conversation

drivers/mailbox/mailbox-mchp-ipc-sbi.c:187 mchp_ipc_cluster_aggr_isr() error: uninitialized symbol 'hartid'.

DISCUSSION Dan Carpenter 1 participant 1 message Dec 17, 2025

lore
Share & tools
lore

Dan Carpenter

author build bot
#0 lore raw

BCC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Valentina Fernandez <[email protected]>
CC: Jassi Brar <[email protected]>

Hi Valentina,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ea1013c1539270e372fc99854bc6e4d94eaeff66
commit: c1382852330ee2e78d884bab2da25b880488fa1c riscv: sbi: vendorid_list: Add Microchip Technology to the vendor list
date:   11 months ago

:::::: branch date: 4 hours ago
:::::: commit date: 11 months ago
config: riscv-randconfig-r071-20251216 (https://download.01.org/0day-ci/archive/20251217/[email protected]/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 1335a05ab8bc8339ce24be3a9da89d8c3f4e0571)

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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

New smatch warnings:
drivers/mailbox/mailbox-mchp-ipc-sbi.c:187 mchp_ipc_cluster_aggr_isr() error: uninitialized symbol 'hartid'.

Old smatch warnings:
drivers/mailbox/mailbox-mchp-ipc-sbi.c:422 mchp_ipc_probe() warn: passing zero to 'dev_err_probe'

vim +/hartid +187 drivers/mailbox/mailbox-mchp-ipc-sbi.c

e4b1d67e71419c Valentina Fernandez 2024-12-17  168  
e4b1d67e71419c Valentina Fernandez 2024-12-17  169  static irqreturn_t mchp_ipc_cluster_aggr_isr(int irq, void *data)
e4b1d67e71419c Valentina Fernandez 2024-12-17  170  {
e4b1d67e71419c Valentina Fernandez 2024-12-17  171  	struct mbox_chan *chan;
e4b1d67e71419c Valentina Fernandez 2024-12-17  172  	struct mchp_ipc_sbi_chan *chan_info;
e4b1d67e71419c Valentina Fernandez 2024-12-17  173  	struct mchp_ipc_sbi_mbox *ipc = (struct mchp_ipc_sbi_mbox *)data;
e4b1d67e71419c Valentina Fernandez 2024-12-17  174  	struct mchp_ipc_msg ipc_msg;
e4b1d67e71419c Valentina Fernandez 2024-12-17  175  	struct mchp_ipc_status status_msg;
e4b1d67e71419c Valentina Fernandez 2024-12-17  176  	int ret;
e4b1d67e71419c Valentina Fernandez 2024-12-17  177  	unsigned long hartid;
e4b1d67e71419c Valentina Fernandez 2024-12-17  178  	u32 i, chan_index, chan_id;
e4b1d67e71419c Valentina Fernandez 2024-12-17  179  
e4b1d67e71419c Valentina Fernandez 2024-12-17  180  	/* Find out the hart that originated the irq */
e4b1d67e71419c Valentina Fernandez 2024-12-17  181  	for_each_online_cpu(i) {
e4b1d67e71419c Valentina Fernandez 2024-12-17  182  		hartid = cpuid_to_hartid_map(i);
e4b1d67e71419c Valentina Fernandez 2024-12-17  183  		if (irq == ipc->cluster_cfg[hartid].irq)
e4b1d67e71419c Valentina Fernandez 2024-12-17  184  			break;
e4b1d67e71419c Valentina Fernandez 2024-12-17  185  	}
e4b1d67e71419c Valentina Fernandez 2024-12-17  186  
e4b1d67e71419c Valentina Fernandez 2024-12-17 @187  	status_msg.cluster = hartid;
e4b1d67e71419c Valentina Fernandez 2024-12-17  188  	memcpy(ipc->cluster_cfg[hartid].buf_base, &status_msg, sizeof(struct mchp_ipc_status));
e4b1d67e71419c Valentina Fernandez 2024-12-17  189  
e4b1d67e71419c Valentina Fernandez 2024-12-17  190  	ret = mchp_ipc_sbi_send(SBI_EXT_IPC_STATUS, ipc->cluster_cfg[hartid].buf_base_addr);
e4b1d67e71419c Valentina Fernandez 2024-12-17  191  	if (ret < 0) {
e4b1d67e71419c Valentina Fernandez 2024-12-17  192  		dev_err_ratelimited(ipc->dev, "could not get IHC irq status ret=%d\n", ret);
e4b1d67e71419c Valentina Fernandez 2024-12-17  193  		return IRQ_HANDLED;
e4b1d67e71419c Valentina Fernandez 2024-12-17  194  	}
e4b1d67e71419c Valentina Fernandez 2024-12-17  195  
e4b1d67e71419c Valentina Fernandez 2024-12-17  196  	memcpy(&status_msg, ipc->cluster_cfg[hartid].buf_base, sizeof(struct mchp_ipc_status));
e4b1d67e71419c Valentina Fernandez 2024-12-17  197  
e4b1d67e71419c Valentina Fernandez 2024-12-17  198  	/*
e4b1d67e71419c Valentina Fernandez 2024-12-17  199  	 * Iterate over each bit set in the IHC interrupt status register (IRQ_STATUS) to identify
e4b1d67e71419c Valentina Fernandez 2024-12-17  200  	 * the channel(s) that have a message to be processed/acknowledged.
e4b1d67e71419c Valentina Fernandez 2024-12-17  201  	 * The bits are organized in alternating format, where each pair of bits represents
e4b1d67e71419c Valentina Fernandez 2024-12-17  202  	 * the status of the message present and message clear interrupts for each cluster/hart
e4b1d67e71419c Valentina Fernandez 2024-12-17  203  	 * (from hart 0 to hart 5). Each cluster can have up to 5 fixed channels associated.
e4b1d67e71419c Valentina Fernandez 2024-12-17  204  	 */
e4b1d67e71419c Valentina Fernandez 2024-12-17  205  
e4b1d67e71419c Valentina Fernandez 2024-12-17  206  	for_each_set_bit(i, (unsigned long *)&status_msg.status, IRQ_STATUS_BITS) {
e4b1d67e71419c Valentina Fernandez 2024-12-17  207  		/* Find out the destination hart that triggered the interrupt */
e4b1d67e71419c Valentina Fernandez 2024-12-17  208  		chan_index = i / 2;
e4b1d67e71419c Valentina Fernandez 2024-12-17  209  
e4b1d67e71419c Valentina Fernandez 2024-12-17  210  		/*
e4b1d67e71419c Valentina Fernandez 2024-12-17  211  		 * The IP has no loopback channels, so we need to decrement the index when
e4b1d67e71419c Valentina Fernandez 2024-12-17  212  		 * the target hart has a greater index than our own
e4b1d67e71419c Valentina Fernandez 2024-12-17  213  		 */
e4b1d67e71419c Valentina Fernandez 2024-12-17  214  		if (chan_index >= status_msg.cluster)
e4b1d67e71419c Valentina Fernandez 2024-12-17  215  			chan_index--;
e4b1d67e71419c Valentina Fernandez 2024-12-17  216  
e4b1d67e71419c Valentina Fernandez 2024-12-17  217  		/*
e4b1d67e71419c Valentina Fernandez 2024-12-17  218  		 * Calculate the channel id given the hart and channel index. Channel IDs
e4b1d67e71419c Valentina Fernandez 2024-12-17  219  		 * are unique across all clusters of an IPC, and iterate contiguously
e4b1d67e71419c Valentina Fernandez 2024-12-17  220  		 * across all clusters.
e4b1d67e71419c Valentina Fernandez 2024-12-17  221  		 */
e4b1d67e71419c Valentina Fernandez 2024-12-17  222  		chan_id = status_msg.cluster * (NUM_CHANS_PER_CLUSTER + chan_index);
e4b1d67e71419c Valentina Fernandez 2024-12-17  223  
e4b1d67e71419c Valentina Fernandez 2024-12-17  224  		chan = &ipc->chans[chan_id];
e4b1d67e71419c Valentina Fernandez 2024-12-17  225  		chan_info = (struct mchp_ipc_sbi_chan *)chan->con_priv;
e4b1d67e71419c Valentina Fernandez 2024-12-17  226  
e4b1d67e71419c Valentina Fernandez 2024-12-17  227  		if (i % 2 == 0) {
e4b1d67e71419c Valentina Fernandez 2024-12-17  228  			mchp_ipc_prepare_receive_req(chan);
e4b1d67e71419c Valentina Fernandez 2024-12-17  229  			ret = mchp_ipc_sbi_chan_send(SBI_EXT_IPC_RECEIVE, chan_id,
e4b1d67e71419c Valentina Fernandez 2024-12-17  230  						     chan_info->buf_base_rx_addr);
e4b1d67e71419c Valentina Fernandez 2024-12-17  231  			if (ret < 0)
e4b1d67e71419c Valentina Fernandez 2024-12-17  232  				continue;
e4b1d67e71419c Valentina Fernandez 2024-12-17  233  
e4b1d67e71419c Valentina Fernandez 2024-12-17  234  			mchp_ipc_process_received_data(chan, &ipc_msg);
e4b1d67e71419c Valentina Fernandez 2024-12-17  235  			mbox_chan_received_data(&ipc->chans[chan_id], (void *)&ipc_msg);
e4b1d67e71419c Valentina Fernandez 2024-12-17  236  
e4b1d67e71419c Valentina Fernandez 2024-12-17  237  		} else {
e4b1d67e71419c Valentina Fernandez 2024-12-17  238  			ret = mchp_ipc_sbi_chan_send(SBI_EXT_IPC_RECEIVE, chan_id,
e4b1d67e71419c Valentina Fernandez 2024-12-17  239  						     chan_info->buf_base_rx_addr);
e4b1d67e71419c Valentina Fernandez 2024-12-17  240  			mbox_chan_txdone(&ipc->chans[chan_id], ret);
e4b1d67e71419c Valentina Fernandez 2024-12-17  241  		}
e4b1d67e71419c Valentina Fernandez 2024-12-17  242  	}
e4b1d67e71419c Valentina Fernandez 2024-12-17  243  	return IRQ_HANDLED;
e4b1d67e71419c Valentina Fernandez 2024-12-17  244  }
e4b1d67e71419c Valentina Fernandez 2024-12-17  245  

:::::: The code at line 187 was first introduced by commit
:::::: e4b1d67e71419c4af581890ecea84b04920d4116 mailbox: add Microchip IPC support

:::::: TO: Valentina Fernandez <[email protected]> :::::: CC: Jassi Brar <[email protected]>

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