Skip to contentSkip to conversation

iommu/amd: Fix compiler warning in copy_device_table()

PATCH In review Joerg Roedel 2 participants 3 messages Aug 18, 2017 – Aug 19, 2017 IOMMU

lore
Share & tools
lore

Joerg Roedel

author maintainer
#0 lore raw

PATCH 1/2 iommu/amd: Fix compiler warning in copy_device_table()

From: Joerg Roedel <[email protected]>

This was reported by the kbuild bot. The condition in which entry would be used uninitialized can not happen, because when there is no iommu this function would never be called. But its no fast-path, so fix the warning anyway.

Reported-by kbuild test robot
---
 drivers/iommu/amd_iommu_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd_iommu_init.c +1 -1
index c7d0325..f2023cd 100644
@@ -854,7 +854,7 @@ static int get_dev_entry_bit(u16 devid, u8 bit)
 
 static bool copy_device_table(void)
 {
-	u64 int_ctl, int_tab_len, entry, last_entry = 0;
+	u64 int_ctl, int_tab_len, entry = 0, last_entry = 0;
 	struct dev_table_entry *old_devtb = NULL;
 	u32 lo, hi, devid, old_devtb_size;
 	phys_addr_t old_devtb_phys;
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH 2/2 iommu/amd: Fix section mismatch warning

From: Joerg Roedel <[email protected]>

The variable amd_iommu_pre_enabled is used in non-init code-paths, so remove the __initdata annotation.

Fixes 3ac3e5ee5ed56 ('iommu/amd: Copy old trans table from old kernel')
---
 drivers/iommu/amd_iommu_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd_iommu_init.c +1 -1
index f2023cd..ff8887a 100644
@@ -264,7 +264,7 @@ static int amd_iommu_enable_interrupts(void);
 static int __init iommu_go_to_state(enum iommu_init_state state);
 static void init_device_table_dma(void);
 
-static bool __initdata amd_iommu_pre_enabled = true;
+static bool amd_iommu_pre_enabled = true;
 
 bool translation_pre_enabled(struct amd_iommu *iommu)
 {
Signature · 1 line
2.7.4
Acked-by on v1 1/2
#2 lore raw
In reply to Joerg Roedel
Quoted 9 lines · Joerg Roedel

From: Joerg Roedel <[email protected]>

This was reported by the kbuild bot. The condition in which entry would be used uninitialized can not happen, because when there is no iommu this function would never be called. But its no fast-path, so fix the warning anyway.

Reported-by kbuild test robot

Thanks for fixing these code bugs, Joerg.

Ack the series!

Quoted 20 lines
---
 drivers/iommu/amd_iommu_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd_iommu_init.c +1 -1
index c7d0325..f2023cd 100644
@@ -854,7 +854,7 @@ static int get_dev_entry_bit(u16 devid, u8 bit)
 
 static bool copy_device_table(void)
 {
-	u64 int_ctl, int_tab_len, entry, last_entry = 0;
+	u64 int_ctl, int_tab_len, entry = 0, last_entry = 0;
 	struct dev_table_entry *old_devtb = NULL;
 	u32 lo, hi, devid, old_devtb_size;
 	phys_addr_t old_devtb_phys;
Signature · 1 line
2.7.4