mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sparc: fix warning comparing pointer to 0
@ 2021-03-15  7:20 Jiapeng Chong
  0 siblings, 0 replies; 2+ messages in thread
From: Jiapeng Chong @ 2021-03-15  7:20 UTC (permalink / raw)
  To: davem; +Cc: sparclinux, linux-kernel, Jiapeng Chong

Fix the following coccicheck warning:

./arch/sparc/prom/tree_64.c:335:15-16: WARNING comparing pointer to 0.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 arch/sparc/prom/tree_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c
index 989e799..85b5101 100644
--- a/arch/sparc/prom/tree_64.c
+++ b/arch/sparc/prom/tree_64.c
@@ -332,7 +332,7 @@ int prom_node_has_property(phandle node, const char *prop)
 
 	if (size == 0)
 		return 0;
-	if ((pname == 0) || (value == 0))
+	if (!pname || !value)
 		return 0;
 	
 #ifdef CONFIG_SUN_LDOMS
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 2+ messages in thread
* [PATCH] sparc: Fix warning comparing pointer to 0
@ 2022-03-24  1:39 Haowen Bai
  0 siblings, 0 replies; 2+ messages in thread
From: Haowen Bai @ 2022-03-24  1:39 UTC (permalink / raw)
  To: davem; +Cc: sparclinux, linux-kernel, Haowen Bai

Avoid pointer type value compared with 0 to make code clear.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
 arch/sparc/prom/tree_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c
index 989e799..88793e5b 100644
--- a/arch/sparc/prom/tree_64.c
+++ b/arch/sparc/prom/tree_64.c
@@ -332,7 +332,7 @@ prom_setprop(phandle node, const char *pname, char *value, int size)
 
 	if (size == 0)
 		return 0;
-	if ((pname == 0) || (value == 0))
+	if ((pname == NULL) || (value == NULL))
 		return 0;
 	
 #ifdef CONFIG_SUN_LDOMS
-- 
2.7.4


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

end of thread, other threads:[~2022-03-24  1:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15  7:20 [PATCH] sparc: fix warning comparing pointer to 0 Jiapeng Chong
2022-03-24  1:39 [PATCH] sparc: Fix " Haowen Bai

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

all inboxes | Powered by JetHome®