diff options
author | Shuah Khan <skhan@linuxfoundation.org> | 2020-06-29 14:02:22 -0600 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2020-07-06 16:10:40 -0600 |
commit | 8e022709c41e55b5b4a9d75a3380b7286c3c588c (patch) | |
tree | 713c452248b0f76995749efd7b99c6b14d9a27ec /tools/power | |
parent | b3a9e3b9622ae10064826dccb4f7a52bd88c7407 (diff) | |
download | linux-8e022709c41e55b5b4a9d75a3380b7286c3c588c.tar.bz2 |
cpupower: Fix comparing pointer to 0 coccicheck warns
Fix cocciccheck wanrns found by:
make coccicheck MODE=report M=tools/power/cpupower/
tools/power/cpupower/utils/helpers/bitmask.c:29:12-13: WARNING comparing pointer to 0, suggest !E
tools/power/cpupower/utils/helpers/bitmask.c:29:12-13: WARNING comparing pointer to 0
tools/power/cpupower/utils/helpers/bitmask.c:43:12-13: WARNING comparing pointer to 0
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/power')
-rw-r--r-- | tools/power/cpupower/utils/helpers/bitmask.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/power/cpupower/utils/helpers/bitmask.c b/tools/power/cpupower/utils/helpers/bitmask.c index 6c7932f5bd66..649d87cb8b0f 100644 --- a/tools/power/cpupower/utils/helpers/bitmask.c +++ b/tools/power/cpupower/utils/helpers/bitmask.c @@ -26,11 +26,11 @@ struct bitmask *bitmask_alloc(unsigned int n) struct bitmask *bmp; bmp = malloc(sizeof(*bmp)); - if (bmp == 0) + if (!bmp) return 0; bmp->size = n; bmp->maskp = calloc(longsperbits(n), sizeof(unsigned long)); - if (bmp->maskp == 0) { + if (!bmp->maskp) { free(bmp); return 0; } @@ -40,7 +40,7 @@ struct bitmask *bitmask_alloc(unsigned int n) /* Free `struct bitmask` */ void bitmask_free(struct bitmask *bmp) { - if (bmp == 0) + if (!bmp) return; free(bmp->maskp); bmp->maskp = (unsigned long *)0xdeadcdef; /* double free tripwire */ |