Skip to contentSkip to conversation

x86: amd_iommu.c device_nb should be static

PATCH In review Jaswinder Singh Rajput 1 participant 2 messages Jul 1, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: amd_iommu.c device_nb should be static

This sparse warning:

arch/x86/kernel/amd_iommu.c:1195:23: warning: symbol 'device_nb' was not declared. Should it be static?

triggers because device_nb is global but is only used in a single .c file. change device_nb to static to fix that - this also address the sparse warning.

This sparse warning:

arch/x86/kernel/amd_iommu.c:1766:10: warning: Using plain integer as NULL pointer

triggers because plain integer 0 is used inplace of NULL pointer. change 0 to NULL to fix that - this also address the sparse warning.

---
 arch/x86/kernel/amd_iommu.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/amd_iommu.c +2 -2
index 9372f04..6c99f50 100644
@@ -1192,7 +1192,7 @@ out:
 	return 0;
 }
 
-struct notifier_block device_nb = {
+static struct notifier_block device_nb = {
 	.notifier_call = device_change_notifier,
 };
 
@@ -1763,7 +1763,7 @@ static void *alloc_coherent(struct device *dev, size_t size,
 	flag |= __GFP_ZERO;
 	virt_addr = (void *)__get_free_pages(flag, get_order(size));
 	if (!virt_addr)
-		return 0;
+		return NULL;
 
 	paddr = virt_to_phys(virt_addr);
 
Signature · 1 line
1.6.0.6
#1 lore raw

[tip:x86/urgent] x86: Mark device_nb as static and fix NULL noise

Commit-ID:  b25ae679f613ed04aaf6ccbfdb9122fce668e4bb
Gitweb:     http://git.kernel.org/tip/b25ae679f613ed04aaf6ccbfdb9122fce668e4bb
Author:     Jaswinder Singh Rajput <[email protected]>
AuthorDate: Wed, 1 Jul 2009 19:53:14 +0530
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 1 Jul 2009 16:52:53 +0200

x86: Mark device_nb as static and fix NULL noise

This sparse warning:

arch/x86/kernel/amd_iommu.c:1195:23: warning: symbol 'device_nb' was not declared. Should it be static?

triggers because device_nb is global but is only used in a single .c file. change device_nb to static to fix that - this also addresses the sparse warning.

This sparse warning:

arch/x86/kernel/amd_iommu.c:1766:10: warning: Using plain integer as NULL pointer

triggers because plain integer 0 is used in place of a NULL pointer. change 0 to NULL to fix that - this also address the sparse warning.

LKML-Reference: <[email protected]>

---
 arch/x86/kernel/amd_iommu.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/amd_iommu.c +2 -2
index 9372f04..6c99f50 100644
@@ -1192,7 +1192,7 @@ out:
 	return 0;
 }
 
-struct notifier_block device_nb = {
+static struct notifier_block device_nb = {
 	.notifier_call = device_change_notifier,
 };
 
@@ -1763,7 +1763,7 @@ static void *alloc_coherent(struct device *dev, size_t size,
 	flag |= __GFP_ZERO;
 	virt_addr = (void *)__get_free_pages(flag, get_order(size));
 	if (!virt_addr)
-		return 0;
+		return NULL;
 
 	paddr = virt_to_phys(virt_addr);