2018-01-17 11:32:24

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH] MIPS: ftrace: Remove pointer comparison to 0 in prepare_ftrace_return

Replace pointer comparison to 0 with NULL in prepare_ftrace_return
to improve code readability. Identified with coccinelle script
'badzero.cocci'.

Signed-off-by: Mathieu Malaterre <[email protected]>
---
arch/mips/kernel/ftrace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index 99285be0e088..7f3dfdbc3657 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -361,7 +361,7 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra,
* If fails when getting the stack address of the non-leaf function's
* ra, stop function graph tracer and return
*/
- if (parent_ra_addr == 0)
+ if (parent_ra_addr == NULL)
goto out;
#endif
/* *parent_ra_addr = return_hooker; */
--
2.11.0


2018-01-17 21:16:22

by James Hogan

[permalink] [raw]
Subject: Re: [PATCH] MIPS: ftrace: Remove pointer comparison to 0 in prepare_ftrace_return

On Wed, Jan 17, 2018 at 12:31:57PM +0100, Mathieu Malaterre wrote:
> Replace pointer comparison to 0 with NULL in prepare_ftrace_return
> to improve code readability. Identified with coccinelle script
> 'badzero.cocci'.
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Reviewed-by: James Hogan <[email protected]>

Cheers
James

> ---
> arch/mips/kernel/ftrace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
> index 99285be0e088..7f3dfdbc3657 100644
> --- a/arch/mips/kernel/ftrace.c
> +++ b/arch/mips/kernel/ftrace.c
> @@ -361,7 +361,7 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra,
> * If fails when getting the stack address of the non-leaf function's
> * ra, stop function graph tracer and return
> */
> - if (parent_ra_addr == 0)
> + if (parent_ra_addr == NULL)
> goto out;
> #endif
> /* *parent_ra_addr = return_hooker; */
> --
> 2.11.0
>
>


Attachments:
(No filename) (1.00 kB)
signature.asc (849.00 B)
Digital signature
Download all attachments

2018-02-01 12:04:20

by James Hogan

[permalink] [raw]
Subject: Re: [PATCH] MIPS: ftrace: Remove pointer comparison to 0 in prepare_ftrace_return

On Wed, Jan 17, 2018 at 12:31:57PM +0100, Mathieu Malaterre wrote:
> Replace pointer comparison to 0 with NULL in prepare_ftrace_return
> to improve code readability. Identified with coccinelle script
> 'badzero.cocci'.
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

I've applied to my 4.16 branch,

Thanks
James

> ---
> arch/mips/kernel/ftrace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
> index 99285be0e088..7f3dfdbc3657 100644
> --- a/arch/mips/kernel/ftrace.c
> +++ b/arch/mips/kernel/ftrace.c
> @@ -361,7 +361,7 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra,
> * If fails when getting the stack address of the non-leaf function's
> * ra, stop function graph tracer and return
> */
> - if (parent_ra_addr == 0)
> + if (parent_ra_addr == NULL)
> goto out;
> #endif
> /* *parent_ra_addr = return_hooker; */
> --
> 2.11.0
>
>


Attachments:
(No filename) (0.99 kB)
signature.asc (849.00 B)
Digital signature
Download all attachments