* Re: [PATCH v3] LoongArch: Fix potential ade in loongson_gpu_fixup_dma_hang()
[not found] <20260428095051.746295-1-guanwentao@uniontech.com>
@ 2026-04-28 22:26 ` kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-04-28 22:26 UTC (permalink / raw)
To: Wentao Guan, chenhuacai
Cc: llvm, oe-kbuild-all, wuqianhai, kernel, jiaxun.yang, loongarch,
linux-kernel, Wentao Guan, stable
Hi Wentao,
kernel test robot noticed the following build warnings:
[auto build test WARNING on chenhuacai-loongson/loongarch-fixes]
[also build test WARNING on linus/master v7.1-rc1 next-20260428]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Wentao-Guan/LoongArch-Fix-potential-ade-in-loongson_gpu_fixup_dma_hang/20260428-222642
base: https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson.git loongarch-fixes
patch link: https://lore.kernel.org/r/20260428095051.746295-1-guanwentao%40uniontech.com
patch subject: [PATCH v3] LoongArch: Fix potential ade in loongson_gpu_fixup_dma_hang()
config: loongarch-allnoconfig (https://download.01.org/0day-ci/archive/20260429/202604290645.yU3tIquW-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 5bac06718f502014fade905512f1d26d578a18f3)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260429/202604290645.yU3tIquW-lkp@intel.com/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
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604290645.yU3tIquW-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> arch/loongarch/pci/pci.c:122:14: warning: variable 'regbase' is uninitialized when used here [-Wuninitialized]
122 | crtc_reg = regbase + 0x1240;
| ^~~~~~~
arch/loongarch/pci/pci.c:114:41: note: initialize the variable 'regbase' to silence this warning
114 | void __iomem *crtc_reg, *base, *regbase;
| ^
| = NULL
1 warning generated.
vim +/regbase +122 arch/loongarch/pci/pci.c
95db0c9f526d58 Huacai Chen 2026-03-26 110
95db0c9f526d58 Huacai Chen 2026-03-26 111 static void loongson_gpu_fixup_dma_hang(struct pci_dev *pdev, bool on)
95db0c9f526d58 Huacai Chen 2026-03-26 112 {
95db0c9f526d58 Huacai Chen 2026-03-26 113 u32 i, val, count, crtc_offset, device;
95db0c9f526d58 Huacai Chen 2026-03-26 114 void __iomem *crtc_reg, *base, *regbase;
95db0c9f526d58 Huacai Chen 2026-03-26 115 static u32 crtc_status[CRTC_NUM_MAX] = { 0 };
95db0c9f526d58 Huacai Chen 2026-03-26 116
95db0c9f526d58 Huacai Chen 2026-03-26 117 base = pdev->bus->ops->map_bus(pdev->bus, pdev->devfn + 1, 0);
95db0c9f526d58 Huacai Chen 2026-03-26 118 device = readw(base + PCI_DEVICE_ID);
95db0c9f526d58 Huacai Chen 2026-03-26 119
95db0c9f526d58 Huacai Chen 2026-03-26 120 switch (device) {
95db0c9f526d58 Huacai Chen 2026-03-26 121 case PCI_DEVICE_ID_LOONGSON_DC2:
95db0c9f526d58 Huacai Chen 2026-03-26 @122 crtc_reg = regbase + 0x1240;
95db0c9f526d58 Huacai Chen 2026-03-26 123 crtc_offset = 0x10;
95db0c9f526d58 Huacai Chen 2026-03-26 124 break;
95db0c9f526d58 Huacai Chen 2026-03-26 125 case PCI_DEVICE_ID_LOONGSON_DC3:
95db0c9f526d58 Huacai Chen 2026-03-26 126 crtc_reg = regbase;
95db0c9f526d58 Huacai Chen 2026-03-26 127 crtc_offset = 0x400;
95db0c9f526d58 Huacai Chen 2026-03-26 128 break;
c2fa5cb09709c4 Wentao Guan 2026-04-28 129 default:
c2fa5cb09709c4 Wentao Guan 2026-04-28 130 return;
c2fa5cb09709c4 Wentao Guan 2026-04-28 131 }
c2fa5cb09709c4 Wentao Guan 2026-04-28 132
c2fa5cb09709c4 Wentao Guan 2026-04-28 133 regbase = ioremap(readq(base + PCI_BASE_ADDRESS_0) & ~0xffull, SZ_64K);
c2fa5cb09709c4 Wentao Guan 2026-04-28 134 if (!regbase) {
c2fa5cb09709c4 Wentao Guan 2026-04-28 135 pci_err(pdev, "Failed to ioremap()\n");
c2fa5cb09709c4 Wentao Guan 2026-04-28 136 return;
95db0c9f526d58 Huacai Chen 2026-03-26 137 }
95db0c9f526d58 Huacai Chen 2026-03-26 138
95db0c9f526d58 Huacai Chen 2026-03-26 139 for (i = 0; i < CRTC_NUM_MAX; i++, crtc_reg += crtc_offset) {
95db0c9f526d58 Huacai Chen 2026-03-26 140 val = readl(crtc_reg);
95db0c9f526d58 Huacai Chen 2026-03-26 141
95db0c9f526d58 Huacai Chen 2026-03-26 142 if (!on)
95db0c9f526d58 Huacai Chen 2026-03-26 143 crtc_status[i] = val;
95db0c9f526d58 Huacai Chen 2026-03-26 144
95db0c9f526d58 Huacai Chen 2026-03-26 145 /* No need to fixup if the status is off at startup. */
95db0c9f526d58 Huacai Chen 2026-03-26 146 if (!(crtc_status[i] & CRTC_OUTPUT_ENABLE))
95db0c9f526d58 Huacai Chen 2026-03-26 147 continue;
95db0c9f526d58 Huacai Chen 2026-03-26 148
95db0c9f526d58 Huacai Chen 2026-03-26 149 if (on)
95db0c9f526d58 Huacai Chen 2026-03-26 150 val |= CRTC_OUTPUT_ENABLE;
95db0c9f526d58 Huacai Chen 2026-03-26 151 else
95db0c9f526d58 Huacai Chen 2026-03-26 152 val &= ~CRTC_OUTPUT_ENABLE;
95db0c9f526d58 Huacai Chen 2026-03-26 153
95db0c9f526d58 Huacai Chen 2026-03-26 154 mb();
95db0c9f526d58 Huacai Chen 2026-03-26 155 writel(val, crtc_reg);
95db0c9f526d58 Huacai Chen 2026-03-26 156
95db0c9f526d58 Huacai Chen 2026-03-26 157 for (count = 0; count < 40; count++) {
95db0c9f526d58 Huacai Chen 2026-03-26 158 val = readl(crtc_reg) & CRTC_OUTPUT_ENABLE;
95db0c9f526d58 Huacai Chen 2026-03-26 159 if ((on && val) || (!on && !val))
95db0c9f526d58 Huacai Chen 2026-03-26 160 break;
95db0c9f526d58 Huacai Chen 2026-03-26 161 udelay(1000);
95db0c9f526d58 Huacai Chen 2026-03-26 162 }
95db0c9f526d58 Huacai Chen 2026-03-26 163
95db0c9f526d58 Huacai Chen 2026-03-26 164 pci_info(pdev, "DMA hang fixup at reg[0x%lx]: 0x%x\n",
95db0c9f526d58 Huacai Chen 2026-03-26 165 (unsigned long)crtc_reg & 0xffff, readl(crtc_reg));
95db0c9f526d58 Huacai Chen 2026-03-26 166 }
95db0c9f526d58 Huacai Chen 2026-03-26 167
95db0c9f526d58 Huacai Chen 2026-03-26 168 iounmap(regbase);
95db0c9f526d58 Huacai Chen 2026-03-26 169 }
95db0c9f526d58 Huacai Chen 2026-03-26 170
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread