* [PATCH linux-next] recordmcount: use "!P" instead of "P == 0"
@ 2022-11-30 7:47 zhang.songyi
2022-11-30 14:05 ` Steven Rostedt
0 siblings, 1 reply; 2+ messages in thread
From: zhang.songyi @ 2022-11-30 7:47 UTC (permalink / raw)
To: zhangqing; +Cc: chenhuacai, rostedt, linux-kernel, zhang.songyi
From: zhang songyi <zhang.songyi@zte.com.cn>
comparing pointer to 0, use !P instead of it.
Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn>
---
scripts/recordmcount.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
index cce12e1971d8..8d01decd12e9 100644
--- a/scripts/recordmcount.c
+++ b/scripts/recordmcount.c
@@ -139,7 +139,7 @@ static ssize_t uwrite(void const *const buf, size_t const count)
static void * umalloc(size_t size)
{
void *const addr = malloc(size);
- if (addr == 0) {
+ if (!addr) {
fprintf(stderr, "malloc failed: %zu bytes\n", size);
file_append_cleanup();
mmap_cleanup();
--
2.15.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH linux-next] recordmcount: use "!P" instead of "P == 0"
2022-11-30 7:47 [PATCH linux-next] recordmcount: use "!P" instead of "P == 0" zhang.songyi
@ 2022-11-30 14:05 ` Steven Rostedt
0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2022-11-30 14:05 UTC (permalink / raw)
To: zhang.songyi; +Cc: zhangqing, chenhuacai, linux-kernel
On Wed, 30 Nov 2022 15:47:35 +0800 (CST)
<zhang.songyi@zte.com.cn> wrote:
> From: zhang songyi <zhang.songyi@zte.com.cn>
>
> comparing pointer to 0, use !P instead of it.
Both are correct. No need for useless churn like this.
-- Steve
>
> Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn>
> ---
> scripts/recordmcount.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
> index cce12e1971d8..8d01decd12e9 100644
> --- a/scripts/recordmcount.c
> +++ b/scripts/recordmcount.c
> @@ -139,7 +139,7 @@ static ssize_t uwrite(void const *const buf, size_t const count)
> static void * umalloc(size_t size)
> {
> void *const addr = malloc(size);
> - if (addr == 0) {
> + if (!addr) {
> fprintf(stderr, "malloc failed: %zu bytes\n", size);
> file_append_cleanup();
> mmap_cleanup();
> --
> 2.15.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-30 14:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-30 7:47 [PATCH linux-next] recordmcount: use "!P" instead of "P == 0" zhang.songyi
2022-11-30 14:05 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox