linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/mm: Fix comparing pointer to 0 warning
@ 2020-11-10  2:56 xiakaixu1987
  2020-11-10  6:07 ` Christophe Leroy
  2020-11-25 11:57 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: xiakaixu1987 @ 2020-11-10  2:56 UTC (permalink / raw)
  To: mpe, benh, paulus; +Cc: Kaixu Xia, linuxppc-dev, linux-kernel

From: Kaixu Xia <kaixuxia@tencent.com>

Fixes coccicheck warning:

./arch/powerpc/mm/pgtable_32.c:87:11-12: WARNING comparing pointer to 0

Avoid pointer type value compared to 0.

Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
---
 arch/powerpc/mm/pgtable_32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 079159e97bca..888b9713a316 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -84,7 +84,7 @@ int __ref map_kernel_page(unsigned long va, phys_addr_t pa, pgprot_t prot)
 		pg = pte_alloc_kernel(pd, va);
 	else
 		pg = early_pte_alloc_kernel(pd, va);
-	if (pg != 0) {
+	if (pg) {
 		err = 0;
 		/* The PTE should never be already set nor present in the
 		 * hash table
-- 
2.20.0


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

* Re: [PATCH] powerpc/mm: Fix comparing pointer to 0 warning
  2020-11-10  2:56 [PATCH] powerpc/mm: Fix comparing pointer to 0 warning xiakaixu1987
@ 2020-11-10  6:07 ` Christophe Leroy
  2020-11-25 11:57 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2020-11-10  6:07 UTC (permalink / raw)
  To: xiakaixu1987, mpe, benh, paulus; +Cc: linuxppc-dev, Kaixu Xia, linux-kernel



Le 10/11/2020 à 03:56, xiakaixu1987@gmail.com a écrit :
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> Fixes coccicheck warning:
> 
> ./arch/powerpc/mm/pgtable_32.c:87:11-12: WARNING comparing pointer to 0
> 
> Avoid pointer type value compared to 0.
> 
> Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>

> ---
>   arch/powerpc/mm/pgtable_32.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
> index 079159e97bca..888b9713a316 100644
> --- a/arch/powerpc/mm/pgtable_32.c
> +++ b/arch/powerpc/mm/pgtable_32.c
> @@ -84,7 +84,7 @@ int __ref map_kernel_page(unsigned long va, phys_addr_t pa, pgprot_t prot)
>   		pg = pte_alloc_kernel(pd, va);
>   	else
>   		pg = early_pte_alloc_kernel(pd, va);
> -	if (pg != 0) {
> +	if (pg) {
>   		err = 0;
>   		/* The PTE should never be already set nor present in the
>   		 * hash table
> 

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

* Re: [PATCH] powerpc/mm: Fix comparing pointer to 0 warning
  2020-11-10  2:56 [PATCH] powerpc/mm: Fix comparing pointer to 0 warning xiakaixu1987
  2020-11-10  6:07 ` Christophe Leroy
@ 2020-11-25 11:57 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2020-11-25 11:57 UTC (permalink / raw)
  To: paulus, xiakaixu1987@gmail.com, mpe, benh
  Cc: linuxppc-dev, Kaixu Xia, linux-kernel

On Tue, 10 Nov 2020 10:56:01 +0800, xiakaixu1987@gmail.com wrote:
> Fixes coccicheck warning:
> 
> ./arch/powerpc/mm/pgtable_32.c:87:11-12: WARNING comparing pointer to 0
> 
> Avoid pointer type value compared to 0.

Applied to powerpc/next.

[1/1] powerpc/mm: Fix comparing pointer to 0 warning
      https://git.kernel.org/powerpc/c/b84bf098fcc49ed6bf4b0a8bed52e9df0e8f1de7

cheers

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

end of thread, other threads:[~2020-11-25 13:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-10  2:56 [PATCH] powerpc/mm: Fix comparing pointer to 0 warning xiakaixu1987
2020-11-10  6:07 ` Christophe Leroy
2020-11-25 11:57 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).