All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/mailbox/mailbox-mchp-ipc-sbi.c:187 mchp_ipc_cluster_aggr_isr() error: uninitialized symbol 'hartid'.
@ 2025-12-17 13:20 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-12-17  7:46 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: Valentina Fernandez <valentina.fernandezalanis@microchip.com>
CC: Jassi Brar <jassisinghbrar@gmail.com>

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/202512171533.CDLdScMY-lkp@intel.com/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 <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202512171533.CDLdScMY-lkp@intel.com/

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 <valentina.fernandezalanis@microchip.com>
:::::: CC: Jassi Brar <jassisinghbrar@gmail.com>

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

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

* drivers/mailbox/mailbox-mchp-ipc-sbi.c:187 mchp_ipc_cluster_aggr_isr() error: uninitialized symbol 'hartid'.
@ 2025-12-17 13:20 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2025-12-17 13:20 UTC (permalink / raw)
  To: oe-kbuild, Valentina Fernandez
  Cc: lkp, oe-kbuild-all, linux-kernel, Jassi Brar

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
config: riscv-randconfig-r071-20251216 (https://download.01.org/0day-ci/archive/20251217/202512171533.CDLdScMY-lkp@intel.com/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 <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202512171533.CDLdScMY-lkp@intel.com/

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
   410  static int mchp_ipc_probe(struct platform_device *pdev)
   411  {
   412          struct device *dev = &pdev->dev;
   413          struct mchp_ipc_mbox_info ipc_info;
   414          struct mchp_ipc_sbi_mbox *ipc;
   415          struct mchp_ipc_sbi_chan *priv;
   416          bool irq_avail = false;
   417          int ret;
   418          u32 chan_id;
   419  
   420          ret = sbi_probe_extension(SBI_EXT_MICROCHIP_TECHNOLOGY);
   421          if (ret <= 0)
   422                  return dev_err_probe(dev, ret, "Microchip SBI extension not detected\n");
                                                  ^^^
sbi_probe_extension() returns zero on error which is success here.

   423  
   424          ipc = devm_kzalloc(dev, sizeof(*ipc), GFP_KERNEL);
   425          if (!ipc)
   426                  return -ENOMEM;
   427  
   428          platform_set_drvdata(pdev, ipc);
   429  
   430          ipc->buf_base = devm_kmalloc(dev, sizeof(struct mchp_ipc_mbox_info), GFP_KERNEL);
   431          if (!ipc->buf_base)
   432                  return -ENOMEM;
   433  
   434          ipc->buf_base_addr = __pa(ipc->buf_base);
   435  
   436          ret = mchp_ipc_sbi_send(SBI_EXT_IPC_PROBE, ipc->buf_base_addr);
   437          if (ret < 0)

-- 
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-12-17 13:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-17  7:46 drivers/mailbox/mailbox-mchp-ipc-sbi.c:187 mchp_ipc_cluster_aggr_isr() error: uninitialized symbol 'hartid' kernel test robot
2025-12-17 13:20 ` Dan Carpenter

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.