drivers/edac/altera_edac.c:541:42: warning: unused variable 'ocramecc_data'

From: kernel test robot
Date: Mon Jun 21 2021 - 12:58:09 EST


Hi Krzysztof,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 13311e74253fe64329390df80bed3f07314ddd61
commit: 4a9a1a5602d82c079325bf37466af0b67d6c0b9e arm64: socfpga: merge Agilex and N5X into ARCH_INTEL_SOCFPGA
date: 3 months ago
config: arm64-randconfig-r024-20210621 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project e1adf90826a57b674eee79b071fb46c1f5683cd0)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4a9a1a5602d82c079325bf37466af0b67d6c0b9e
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 4a9a1a5602d82c079325bf37466af0b67d6c0b9e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/edac/altera_edac.c:541:42: warning: unused variable 'ocramecc_data' [-Wunused-const-variable]
static const struct edac_device_prv_data ocramecc_data;
^
drivers/edac/altera_edac.c:542:42: warning: unused variable 'l2ecc_data' [-Wunused-const-variable]
static const struct edac_device_prv_data l2ecc_data;
^
>> drivers/edac/altera_edac.c:543:42: warning: unused variable 'a10_ocramecc_data' [-Wunused-const-variable]
static const struct edac_device_prv_data a10_ocramecc_data;
^
drivers/edac/altera_edac.c:544:42: warning: unused variable 'a10_l2ecc_data' [-Wunused-const-variable]
static const struct edac_device_prv_data a10_l2ecc_data;
^
>> drivers/edac/altera_edac.c:642:37: warning: unused variable 'altr_edac_device_inject_fops' [-Wunused-const-variable]
static const struct file_operations altr_edac_device_inject_fops = {
^
5 warnings generated.


vim +/ocramecc_data +541 drivers/edac/altera_edac.c

c3eea1942a16db Thor Thayer 2016-02-10 532
c3eea1942a16db Thor Thayer 2016-02-10 533 /*
c3eea1942a16db Thor Thayer 2016-02-10 534 * EDAC Device Functions (shared between various IPs).
c3eea1942a16db Thor Thayer 2016-02-10 535 * The discrete memories use the EDAC Device framework. The probe
c3eea1942a16db Thor Thayer 2016-02-10 536 * and error handling functions are very similar between memories
c3eea1942a16db Thor Thayer 2016-02-10 537 * so they are shared. The memory allocation and freeing for EDAC
c3eea1942a16db Thor Thayer 2016-02-10 538 * trigger testing are different for each memory.
c3eea1942a16db Thor Thayer 2016-02-10 539 */
c3eea1942a16db Thor Thayer 2016-02-10 540
1cf70377247302 Thor Thayer 2016-06-22 @541 static const struct edac_device_prv_data ocramecc_data;
1cf70377247302 Thor Thayer 2016-06-22 542 static const struct edac_device_prv_data l2ecc_data;
1cf70377247302 Thor Thayer 2016-06-22 @543 static const struct edac_device_prv_data a10_ocramecc_data;
1cf70377247302 Thor Thayer 2016-06-22 544 static const struct edac_device_prv_data a10_l2ecc_data;
c3eea1942a16db Thor Thayer 2016-02-10 545
c3eea1942a16db Thor Thayer 2016-02-10 546 static irqreturn_t altr_edac_device_handler(int irq, void *dev_id)
c3eea1942a16db Thor Thayer 2016-02-10 547 {
c3eea1942a16db Thor Thayer 2016-02-10 548 irqreturn_t ret_value = IRQ_NONE;
c3eea1942a16db Thor Thayer 2016-02-10 549 struct edac_device_ctl_info *dci = dev_id;
c3eea1942a16db Thor Thayer 2016-02-10 550 struct altr_edac_device_dev *drvdata = dci->pvt_info;
c3eea1942a16db Thor Thayer 2016-02-10 551 const struct edac_device_prv_data *priv = drvdata->data;
c3eea1942a16db Thor Thayer 2016-02-10 552
c3eea1942a16db Thor Thayer 2016-02-10 553 if (irq == drvdata->sb_irq) {
c3eea1942a16db Thor Thayer 2016-02-10 554 if (priv->ce_clear_mask)
c3eea1942a16db Thor Thayer 2016-02-10 555 writel(priv->ce_clear_mask, drvdata->base);
c3eea1942a16db Thor Thayer 2016-02-10 556 edac_device_handle_ce(dci, 0, 0, drvdata->edac_dev_name);
c3eea1942a16db Thor Thayer 2016-02-10 557 ret_value = IRQ_HANDLED;
c3eea1942a16db Thor Thayer 2016-02-10 558 } else if (irq == drvdata->db_irq) {
c3eea1942a16db Thor Thayer 2016-02-10 559 if (priv->ue_clear_mask)
c3eea1942a16db Thor Thayer 2016-02-10 560 writel(priv->ue_clear_mask, drvdata->base);
c3eea1942a16db Thor Thayer 2016-02-10 561 edac_device_handle_ue(dci, 0, 0, drvdata->edac_dev_name);
c3eea1942a16db Thor Thayer 2016-02-10 562 panic("\nEDAC:ECC_DEVICE[Uncorrectable errors]\n");
c3eea1942a16db Thor Thayer 2016-02-10 563 ret_value = IRQ_HANDLED;
c3eea1942a16db Thor Thayer 2016-02-10 564 } else {
c3eea1942a16db Thor Thayer 2016-02-10 565 WARN_ON(1);
c3eea1942a16db Thor Thayer 2016-02-10 566 }
c3eea1942a16db Thor Thayer 2016-02-10 567
c3eea1942a16db Thor Thayer 2016-02-10 568 return ret_value;
c3eea1942a16db Thor Thayer 2016-02-10 569 }
c3eea1942a16db Thor Thayer 2016-02-10 570
c3eea1942a16db Thor Thayer 2016-02-10 571 static ssize_t altr_edac_device_trig(struct file *file,
c3eea1942a16db Thor Thayer 2016-02-10 572 const char __user *user_buf,
c3eea1942a16db Thor Thayer 2016-02-10 573 size_t count, loff_t *ppos)
c3eea1942a16db Thor Thayer 2016-02-10 574
c3eea1942a16db Thor Thayer 2016-02-10 575 {
c3eea1942a16db Thor Thayer 2016-02-10 576 u32 *ptemp, i, error_mask;
c3eea1942a16db Thor Thayer 2016-02-10 577 int result = 0;
c3eea1942a16db Thor Thayer 2016-02-10 578 u8 trig_type;
c3eea1942a16db Thor Thayer 2016-02-10 579 unsigned long flags;
c3eea1942a16db Thor Thayer 2016-02-10 580 struct edac_device_ctl_info *edac_dci = file->private_data;
c3eea1942a16db Thor Thayer 2016-02-10 581 struct altr_edac_device_dev *drvdata = edac_dci->pvt_info;
c3eea1942a16db Thor Thayer 2016-02-10 582 const struct edac_device_prv_data *priv = drvdata->data;
c3eea1942a16db Thor Thayer 2016-02-10 583 void *generic_ptr = edac_dci->dev;
c3eea1942a16db Thor Thayer 2016-02-10 584
c3eea1942a16db Thor Thayer 2016-02-10 585 if (!user_buf || get_user(trig_type, user_buf))
c3eea1942a16db Thor Thayer 2016-02-10 586 return -EFAULT;
c3eea1942a16db Thor Thayer 2016-02-10 587
c3eea1942a16db Thor Thayer 2016-02-10 588 if (!priv->alloc_mem)
c3eea1942a16db Thor Thayer 2016-02-10 589 return -ENOMEM;
c3eea1942a16db Thor Thayer 2016-02-10 590
c3eea1942a16db Thor Thayer 2016-02-10 591 /*
c3eea1942a16db Thor Thayer 2016-02-10 592 * Note that generic_ptr is initialized to the device * but in
c3eea1942a16db Thor Thayer 2016-02-10 593 * some alloc_functions, this is overridden and returns data.
c3eea1942a16db Thor Thayer 2016-02-10 594 */
c3eea1942a16db Thor Thayer 2016-02-10 595 ptemp = priv->alloc_mem(priv->trig_alloc_sz, &generic_ptr);
c3eea1942a16db Thor Thayer 2016-02-10 596 if (!ptemp) {
c3eea1942a16db Thor Thayer 2016-02-10 597 edac_printk(KERN_ERR, EDAC_DEVICE,
c3eea1942a16db Thor Thayer 2016-02-10 598 "Inject: Buffer Allocation error\n");
c3eea1942a16db Thor Thayer 2016-02-10 599 return -ENOMEM;
c3eea1942a16db Thor Thayer 2016-02-10 600 }
c3eea1942a16db Thor Thayer 2016-02-10 601
c3eea1942a16db Thor Thayer 2016-02-10 602 if (trig_type == ALTR_UE_TRIGGER_CHAR)
c3eea1942a16db Thor Thayer 2016-02-10 603 error_mask = priv->ue_set_mask;
c3eea1942a16db Thor Thayer 2016-02-10 604 else
c3eea1942a16db Thor Thayer 2016-02-10 605 error_mask = priv->ce_set_mask;
c3eea1942a16db Thor Thayer 2016-02-10 606
c3eea1942a16db Thor Thayer 2016-02-10 607 edac_printk(KERN_ALERT, EDAC_DEVICE,
c3eea1942a16db Thor Thayer 2016-02-10 608 "Trigger Error Mask (0x%X)\n", error_mask);
c3eea1942a16db Thor Thayer 2016-02-10 609
c3eea1942a16db Thor Thayer 2016-02-10 610 local_irq_save(flags);
c3eea1942a16db Thor Thayer 2016-02-10 611 /* write ECC corrupted data out. */
c3eea1942a16db Thor Thayer 2016-02-10 612 for (i = 0; i < (priv->trig_alloc_sz / sizeof(*ptemp)); i++) {
c3eea1942a16db Thor Thayer 2016-02-10 613 /* Read data so we're in the correct state */
c3eea1942a16db Thor Thayer 2016-02-10 614 rmb();
332efa6374de75 Mark Rutland 2017-10-23 615 if (READ_ONCE(ptemp[i]))
c3eea1942a16db Thor Thayer 2016-02-10 616 result = -1;
c3eea1942a16db Thor Thayer 2016-02-10 617 /* Toggle Error bit (it is latched), leave ECC enabled */
811fce4f2a7aea Thor Thayer 2016-03-21 618 writel(error_mask, (drvdata->base + priv->set_err_ofst));
811fce4f2a7aea Thor Thayer 2016-03-21 619 writel(priv->ecc_enable_mask, (drvdata->base +
811fce4f2a7aea Thor Thayer 2016-03-21 620 priv->set_err_ofst));
c3eea1942a16db Thor Thayer 2016-02-10 621 ptemp[i] = i;
c3eea1942a16db Thor Thayer 2016-02-10 622 }
c3eea1942a16db Thor Thayer 2016-02-10 623 /* Ensure it has been written out */
c3eea1942a16db Thor Thayer 2016-02-10 624 wmb();
c3eea1942a16db Thor Thayer 2016-02-10 625 local_irq_restore(flags);
c3eea1942a16db Thor Thayer 2016-02-10 626
c3eea1942a16db Thor Thayer 2016-02-10 627 if (result)
c3eea1942a16db Thor Thayer 2016-02-10 628 edac_printk(KERN_ERR, EDAC_DEVICE, "Mem Not Cleared\n");
c3eea1942a16db Thor Thayer 2016-02-10 629
c3eea1942a16db Thor Thayer 2016-02-10 630 /* Read out written data. ECC error caused here */
c3eea1942a16db Thor Thayer 2016-02-10 631 for (i = 0; i < ALTR_TRIGGER_READ_WRD_CNT; i++)
332efa6374de75 Mark Rutland 2017-10-23 632 if (READ_ONCE(ptemp[i]) != i)
c3eea1942a16db Thor Thayer 2016-02-10 633 edac_printk(KERN_ERR, EDAC_DEVICE,
c3eea1942a16db Thor Thayer 2016-02-10 634 "Read doesn't match written data\n");
c3eea1942a16db Thor Thayer 2016-02-10 635
c3eea1942a16db Thor Thayer 2016-02-10 636 if (priv->free_mem)
c3eea1942a16db Thor Thayer 2016-02-10 637 priv->free_mem(ptemp, priv->trig_alloc_sz, generic_ptr);
c3eea1942a16db Thor Thayer 2016-02-10 638
c3eea1942a16db Thor Thayer 2016-02-10 639 return count;
c3eea1942a16db Thor Thayer 2016-02-10 640 }
c3eea1942a16db Thor Thayer 2016-02-10 641
c3eea1942a16db Thor Thayer 2016-02-10 @642 static const struct file_operations altr_edac_device_inject_fops = {
c3eea1942a16db Thor Thayer 2016-02-10 643 .open = simple_open,
c3eea1942a16db Thor Thayer 2016-02-10 644 .write = altr_edac_device_trig,
c3eea1942a16db Thor Thayer 2016-02-10 645 .llseek = generic_file_llseek,
c3eea1942a16db Thor Thayer 2016-02-10 646 };
c3eea1942a16db Thor Thayer 2016-02-10 647

:::::: The code at line 541 was first introduced by commit
:::::: 1cf703772473022ac89d815871b20aa4738449b4 EDAC, altera: Make all private data structures static

:::::: TO: Thor Thayer <tthayer@xxxxxxxxxxxxxxxxxxxxx>
:::::: CC: Borislav Petkov <bp@xxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip