0 -> NULL, for arch/blackfin
PATCH 4/68 0 -> NULL, for arch/blackfin
When comparing a pointer, it's clearer to compare it to NULL than to 0.
Here is an excerpt of the semantic patch:
@@
expression *E;
@@
E =
- 0
+ NULL
@@
expression *E;
@@
E !- 0
+ NULL
---
traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/blackfin/kernel/traps.c +1 -1
@@ -546,7 +546,7 @@ void dump_bfin_regs(struct pt_regs *fp, }printk (KERN_EMERG "return address: [0x%p]; contents of:" , retaddr); - if (retaddr != 0 && retaddr <= (void *)physical_mem_end + if (retaddr != NULL && retaddr <= (void *)physical_mem_end#if L1_CODE_LENGTH !=0 /* FIXME: Copy the code out of L1 Instruction SRAM through dma memcpy. */
Quoted 34 lines · Yoann Padioleau
When comparing a pointer, it's clearer to compare it to NULL than to 0.
Here is an excerpt of the semantic patch:
@@
expression *E;
@@E ==
- 0
+ NULL@@
expression *E;
@@E !=
- 0
+ NULLSigned-off-by Yoann Padioleau <[email protected]>---
traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/blackfin/kernel/traps.c +0
-0
arch/blackfin/kernel/traps.c void dump_bfin_regs(struct pt_regs *fp, · line 552
Quoted 8 lines
arch/blackfin/kernel/traps.c +1
-1@@ -546,7 +546,7 @@ void dump_bfin_regs(struct pt_regs *fp, }printk (KERN_EMERG "return address: [0x%p]; contents of:" , retaddr); - if (retaddr != 0 && retaddr <= (void *)physical_mem_end + if (retaddr != NULL && retaddr <= (void *)physical_mem_end#if L1_CODE_LENGTH !=0 /* FIXME: Copy the code out of L1 Instruction SRAM through dma memcpy. */
Why not just use " if (!E)" instead of " if (E != NULL)"? more readable?
Thanks
- Bryan Wu
Quoted 36 lines · Bryan Wu
Quoted 35 lines · Yoann Padioleau
When comparing a pointer, it's clearer to compare it to NULL than to 0.
Here is an excerpt of the semantic patch:
@@
expression *E;
@@E =
- 0
+ NULL@@
expression *E;
@@E !> > - 0
+ NULLSigned-off-by Yoann Padioleau <[email protected]>---
traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/blackfin/kernel/traps.c +0
-0@@ -546,7 +546,7 @@ void dump_bfin_regs(struct pt_regs *fp, }
Quoted 10 lines
arch/blackfin/kernel/traps.c void dump_bfin_regs(struct pt_regs *fp, · line 552
Quoted 6 lines
arch/blackfin/kernel/traps.c +1
-1printk (KERN_EMERG "return address: [0x%p]; contents of:" , retaddr); - if (retaddr != 0 && retaddr <= (void *)physical_mem_end + if (retaddr != NULL && retaddr <= (void *)physical_mem_end#if L1_CODE_LENGTH !=0 /* FIXME: Copy the code out of L1 Instruction SRAM through dma memcpy. */ Why not just use " if (!E)" instead of " if (E != NULL)"? more readable?
Or even "if (E)"
Uli
Signature · 12 lines
------- ROAD ...the handyPC Company - - - ) ) ) Uli Luckas Software Development ROAD GmbH Bennigsenstr. 14 | 12159 Berlin | Germany fon: +49 (30) 230069 - 64 | fax: +49 (30) 230069 - 69 url: www.road.de Amtsgericht Charlottenburg: HRB 96688 B Managing directors: Hans-Peter Constien, Hubertus von Streit