Skip to contentSkip to conversation

iommu/amd: Remove unused variable

PATCH New Joerg Roedel 2 participants 3 messages Dec 23, 2019 – Dec 25, 2019 IOMMU

lore
Share & tools
lore

Joerg Roedel

author maintainer
#0 lore raw

PATCH 1/1 iommu/amd: Remove unused variable

From: Joerg Roedel <[email protected]>

The iommu variable in set_device_exclusion_range() us unused now and causes a compiler warning. Remove it.

Fixes 387caf0b759a ("iommu/amd: Treat per-device exclusion ranges as r/w unity-mapped regions")
---
 drivers/iommu/amd_iommu_init.c | 2 --
 1 file changed, 2 deletions(-)
drivers/iommu/amd_iommu_init.c +0 -2
index 36649592ddf3..ba7ee4aa04f9 100644
@@ -1118,8 +1118,6 @@ static int __init add_early_maps(void)
  */
 static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m)
 {
-	struct amd_iommu *iommu = amd_iommu_rlookup_table[devid];
-
 	if (!(m->flags & IVMD_FLAG_EXCL_RANGE))
 		return;
 
Signature · 1 line
2.16.4
#1 lore raw
I love your patch! Yet something to improve:

Hi Joerg,

I love your patch! Yet something to improve:

[auto build test ERROR on linux/master]
[cannot apply to iommu/next linus/master v5.5-rc3 next-20191220] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Joerg-Roedel/iommu-amd-Remove-unused-variable/20191225-070431
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1522d9da40bdfe502c91163e6d769332897201fa
config: x86_64-defconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-3) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

drivers/iommu/amd_iommu_init.c: In function 'set_device_exclusion_range':

>> drivers/iommu/amd_iommu_init.c:1122:6: error: 'iommu' undeclared (first use in this function)
     if (iommu) {
         ^~~~~

drivers/iommu/amd_iommu_init.c:1122:6: note: each undeclared identifier is reported only once for each function it appears in

vim +/iommu +1122 drivers/iommu/amd_iommu_init.c

235dacbc795bb7 drivers/iommu/amd_iommu_init.c   Joerg Roedel 2013-04-09  1112  
b65233a9c1da58 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1113  /*
df805abb28fa49 drivers/iommu/amd_iommu_init.c   Frank Arnold 2012-08-27  1114   * Reads the device exclusion range from ACPI and initializes the IOMMU with
b65233a9c1da58 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1115   * it
b65233a9c1da58 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1116   */
3566b7786afd7c arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1117  static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m)
3566b7786afd7c arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1118  {
3566b7786afd7c arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1119  	if (!(m->flags & IVMD_FLAG_EXCL_RANGE))
3566b7786afd7c arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1120  		return;
3566b7786afd7c arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1121  
3566b7786afd7c arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26 @1122  	if (iommu) {
b65233a9c1da58 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1123  		/*
b65233a9c1da58 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1124  		 * We only can configure exclusion ranges per IOMMU, not
b65233a9c1da58 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1125  		 * per device. But we can enable the exclusion range per
b65233a9c1da58 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1126  		 * device. This is done here
b65233a9c1da58 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1127  		 */
2c16c9fdacbbf3 drivers/iommu/amd_iommu_init.c   Su Friendy   2014-05-07  1128  		set_dev_entry_bit(devid, DEV_ENTRY_EX);
3566b7786afd7c arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1129  		iommu->exclusion_start = m->range_start;
3566b7786afd7c arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1130  		iommu->exclusion_length = m->range_length;
3566b7786afd7c arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1131  	}
3566b7786afd7c arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1132  }

3566b7786afd7c arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26 1133

:::::: The code at line 1122 was first introduced by commit
:::::: 3566b7786afd7c14c62726f359df3c827054670b x86, AMD IOMMU: add device table initialization functions

:::::: TO: Joerg Roedel <[email protected]>
:::::: CC: Ingo Molnar <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

#2 lore raw
In reply to Joerg Roedel
I love your patch! Yet something to improve:

Hi Joerg,

I love your patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.5-rc3 next-20191220] [cannot apply to iommu/next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Joerg-Roedel/iommu-amd-Remove-unused-variable/20191225-070431
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1522d9da40bdfe502c91163e6d769332897201fa
config: x86_64-randconfig-b001-20191224 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-3) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

drivers//iommu/amd_iommu_init.c: In function 'set_device_exclusion_range':

>> drivers//iommu/amd_iommu_init.c:1122:6: error: 'iommu' undeclared (first use in this function); did you mean 'no_iommu'?
     if (iommu) {
         ^~~~~
         no_iommu

drivers//iommu/amd_iommu_init.c:1122:6: note: each undeclared identifier is reported only once for each function it appears in

vim +1122 drivers//iommu/amd_iommu_init.c

235dacbc795bb7c drivers/iommu/amd_iommu_init.c   Joerg Roedel 2013-04-09  1112  
b65233a9c1da587 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1113  /*
df805abb28fa495 drivers/iommu/amd_iommu_init.c   Frank Arnold 2012-08-27  1114   * Reads the device exclusion range from ACPI and initializes the IOMMU with
b65233a9c1da587 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1115   * it
b65233a9c1da587 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1116   */
3566b7786afd7c1 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1117  static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m)
3566b7786afd7c1 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1118  {
3566b7786afd7c1 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1119  	if (!(m->flags & IVMD_FLAG_EXCL_RANGE))
3566b7786afd7c1 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1120  		return;
3566b7786afd7c1 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1121  
3566b7786afd7c1 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26 @1122  	if (iommu) {
b65233a9c1da587 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1123  		/*
b65233a9c1da587 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1124  		 * We only can configure exclusion ranges per IOMMU, not
b65233a9c1da587 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1125  		 * per device. But we can enable the exclusion range per
b65233a9c1da587 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1126  		 * device. This is done here
b65233a9c1da587 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-07-11  1127  		 */
2c16c9fdacbbf3b drivers/iommu/amd_iommu_init.c   Su Friendy   2014-05-07  1128  		set_dev_entry_bit(devid, DEV_ENTRY_EX);
3566b7786afd7c1 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1129  		iommu->exclusion_start = m->range_start;
3566b7786afd7c1 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1130  		iommu->exclusion_length = m->range_length;
3566b7786afd7c1 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1131  	}
3566b7786afd7c1 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26  1132  }

3566b7786afd7c1 arch/x86/kernel/amd_iommu_init.c Joerg Roedel 2008-06-26 1133

:::::: The code at line 1122 was first introduced by commit
:::::: 3566b7786afd7c14c62726f359df3c827054670b x86, AMD IOMMU: add device table initialization functions

:::::: TO: Joerg Roedel <[email protected]>
:::::: CC: Ingo Molnar <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation