Skip to content

Commit e9417f0

Browse files
committed
npu:phytium: fix build error in phytium_npu_pci_probe
Log: 2025-05-16T15:13:43.6129337Z drivers/staging/phytium-npu/phytium_npu_pci.c:82:16: error: variable 'reg_addr' is used uninitialized whenever 'for' loop exits because its condition is false [-Werror,-Wsometimes-uninitialized] 2025-05-16T15:13:43.6131548Z 82 | for (bar = 0; bar < NUM_PCI_BARS; bar++) { 2025-05-16T15:13:43.6132195Z | ^~~~~~~~~~~~~~~~~~ 2025-05-16T15:13:43.6133127Z drivers/staging/phytium-npu/phytium_npu_pci.c:98:7: note: uninitialized use occurs here 2025-05-16T15:13:43.6134010Z 98 | if (!reg_addr) 2025-05-16T15:13:43.6134457Z | ^~~~~~~~ 2025-05-16T15:13:43.6135385Z drivers/staging/phytium-npu/phytium_npu_pci.c:82:16: note: remove the condition if it is always true 2025-05-16T15:13:43.6136692Z 82 | for (bar = 0; bar < NUM_PCI_BARS; bar++) { 2025-05-16T15:13:43.6137381Z | ^~~~~~~~~~~~~~~~~~ 2025-05-16T15:13:43.6138490Z drivers/staging/phytium-npu/phytium_npu_pci.c:52:24: note: initialize the variable 'reg_addr' to silence this warning 2025-05-16T15:13:43.6139510Z 52 | void __iomem *reg_addr; 2025-05-16T15:13:43.6140038Z | ^ 2025-05-16T15:13:43.6140541Z | = NULL 2025-05-16T15:13:43.6141173Z 1 error generated. Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent b01ddcb commit e9417f0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/staging/phytium-npu/phytium_npu_pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static int phytium_npu_pci_probe(struct pci_dev *pci_dev,
4949
{
5050
struct phytium_npu_dev *npu_dev;
5151
struct device *dev = &pci_dev->dev;
52-
void __iomem *reg_addr;
52+
void __iomem *reg_addr = NULL;
5353
int ret = 0;
5454
int irq = 0;
5555
int bar = 0;

0 commit comments

Comments
 (0)