From 44de57931176c5c6a0eff9e2dfb8025e3a36873d Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Wed, 14 Apr 2021 09:18:16 +0200 Subject: [PATCH] cpumf/chcpumf: Simplify comparison against 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplify comparison against 0 or NULL and fix a checkpatch.pl warning. Signed-off-by: Thomas Richter Signed-off-by: Jan Höppner --- cpumf/chcpumf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpumf/chcpumf.c b/cpumf/chcpumf.c index 3f7056aa..09d6e7cf 100644 --- a/cpumf/chcpumf.c +++ b/cpumf/chcpumf.c @@ -96,7 +96,7 @@ static int read_sfb(unsigned long *min, unsigned long *max) return EXIT_FAILURE; } fp = fopen(PERF_SFB_SIZE, "r"); - if (fp == NULL) { + if (!fp) { linux_error(PERF_SFB_SIZE); return EXIT_FAILURE; } @@ -122,7 +122,7 @@ static int write_sfb(unsigned long min, unsigned long max) FILE *fp; fp = fopen(PERF_SFB_SIZE, "w"); - if (fp == NULL) { + if (!fp) { linux_error(PERF_SFB_SIZE); return EXIT_FAILURE; } @@ -204,7 +204,7 @@ int main(int argc, char **argv) util_opt_init(opt_vec, NULL); parse_args(argc, argv); - if (stat(PERF_PATH PERF_SF, &sbuf) != 0) { + if (stat(PERF_PATH PERF_SF, &sbuf)) { fprintf(stderr, "No CPU-measurement sampling facility detected\n"); return ret;