Skip to content

Commit 46cda62

Browse files
committed
Fix the compile-time bug 4557654
1 parent 86ee2c1 commit 46cda62

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/gdrdrv/gdrdrv.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,13 +1449,18 @@ static int __init gdrdrv_init(void)
14491449
gdr_msg(KERN_INFO, "The platform may support CPU cached mappings. Decision to use cached mappings is left to the pinning function.\n");
14501450

14511451
#if defined(CONFIG_ARM64)
1452-
for (int i = 0; i < ARRAY_SIZE(GDRDRV_BF3_PCI_ROOT_DEV_DEVICE_ID); ++i)
14531452
{
1454-
struct pci_dev *pdev = pci_get_device(GDRDRV_BF3_PCI_ROOT_DEV_VENDOR_ID, GDRDRV_BF3_PCI_ROOT_DEV_DEVICE_ID[i], NULL);
1455-
if (pdev) {
1456-
pci_dev_put(pdev);
1457-
gdrdrv_cpu_must_use_device_mapping = 1;
1458-
break;
1453+
// Some compilers are strict and do not allow us to declare a variable
1454+
// in the for statement.
1455+
int i;
1456+
for (i = 0; i < ARRAY_SIZE(GDRDRV_BF3_PCI_ROOT_DEV_DEVICE_ID); ++i)
1457+
{
1458+
struct pci_dev *pdev = pci_get_device(GDRDRV_BF3_PCI_ROOT_DEV_VENDOR_ID, GDRDRV_BF3_PCI_ROOT_DEV_DEVICE_ID[i], NULL);
1459+
if (pdev) {
1460+
pci_dev_put(pdev);
1461+
gdrdrv_cpu_must_use_device_mapping = 1;
1462+
break;
1463+
}
14591464
}
14601465
}
14611466
#endif

0 commit comments

Comments
 (0)