public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -tip RESEND] x86: amd_iommu.c device_nb should be static
@ 2009-07-01 12:17 Jaswinder Singh Rajput
  2009-07-01 13:22 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Jaswinder Singh Rajput @ 2009-07-01 12:17 UTC (permalink / raw)
  To: Ingo Molnar, Joerg Roedel, x86 maintainers, LKML


device_nb is used only by same file, it should be static.

Also fixed NULL pointer issue.

Fixed following sparse warnings :
  arch/x86/kernel/amd_iommu.c:1195:23: warning: symbol 'device_nb' was not declared. Should it be static?
  arch/x86/kernel/amd_iommu.c:1766:10: warning: Using plain integer as NULL pointer

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 arch/x86/kernel/amd_iommu.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 9372f04..6c99f50 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -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);
 
-- 
1.6.0.6




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -tip RESEND] x86: amd_iommu.c device_nb should be static
  2009-07-01 12:17 [PATCH -tip RESEND] x86: amd_iommu.c device_nb should be static Jaswinder Singh Rajput
@ 2009-07-01 13:22 ` Ingo Molnar
  2009-07-01 13:50   ` Jaswinder Singh Rajput
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2009-07-01 13:22 UTC (permalink / raw)
  To: Jaswinder Singh Rajput; +Cc: Joerg Roedel, x86 maintainers, LKML


* Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:

> 
> device_nb is used only by same file, it should be static.
> 
> Also fixed NULL pointer issue.
> 
> Fixed following sparse warnings :
>   arch/x86/kernel/amd_iommu.c:1195:23: warning: symbol 'device_nb' was not declared. Should it be static?
>   arch/x86/kernel/amd_iommu.c:1766:10: warning: Using plain integer as NULL pointer

Mind resending this with a proper changelog, along the template of:

|  This Sparse warning:
|
|      arch/x86/kernel/amd_iommu.c...
|
|  triggers because <reason>. <do action> to fix that - this also
|  addresses the Sparse warning.

Where, in this current case:

 <reason>    := device_nb is global but is only used in a single .c file
 <do action> := change device_nb to static

Please fill in the reason and action for the NULL fix as well.

Please write all similar warning fix commit log messages in a 
similar way in the future if you want me to apply them.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -tip RESEND] x86: amd_iommu.c device_nb should be static
  2009-07-01 13:22 ` Ingo Molnar
@ 2009-07-01 13:50   ` Jaswinder Singh Rajput
  0 siblings, 0 replies; 3+ messages in thread
From: Jaswinder Singh Rajput @ 2009-07-01 13:50 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Joerg Roedel, x86 maintainers, LKML

On Wed, 2009-07-01 at 15:22 +0200, Ingo Molnar wrote:
> * Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:
> 
> > 
> > device_nb is used only by same file, it should be static.
> > 
> > Also fixed NULL pointer issue.
> > 
> > Fixed following sparse warnings :
> >   arch/x86/kernel/amd_iommu.c:1195:23: warning: symbol 'device_nb' was not declared. Should it be static?
> >   arch/x86/kernel/amd_iommu.c:1766:10: warning: Using plain integer as NULL pointer
> 
> Mind resending this with a proper changelog, along the template of:
> 
> |  This Sparse warning:
> |
> |      arch/x86/kernel/amd_iommu.c...
> |
> |  triggers because <reason>. <do action> to fix that - this also
> |  addresses the Sparse warning.
> 
> Where, in this current case:
> 
>  <reason>    := device_nb is global but is only used in a single .c file
>  <do action> := change device_nb to static
> 
> Please fill in the reason and action for the NULL fix as well.
> 
> Please write all similar warning fix commit log messages in a 
> similar way in the future if you want me to apply them.
> 

Please apply this :

[PATCH] 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 in place of NULL pointer.
change 0 to NULL to fix that - this also address the sparse warning.

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 arch/x86/kernel/amd_iommu.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 9372f04..6c99f50 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -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);
 
-- 
1.6.0.6





^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-01 13:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-01 12:17 [PATCH -tip RESEND] x86: amd_iommu.c device_nb should be static Jaswinder Singh Rajput
2009-07-01 13:22 ` Ingo Molnar
2009-07-01 13:50   ` Jaswinder Singh Rajput

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox