Skip to content

Commit 8e02270

Browse files
committed
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 <[email protected]>
1 parent b3a9e3b commit 8e02270

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/power/cpupower/utils/helpers/bitmask.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ struct bitmask *bitmask_alloc(unsigned int n)
2626
struct bitmask *bmp;
2727

2828
bmp = malloc(sizeof(*bmp));
29-
if (bmp == 0)
29+
if (!bmp)
3030
return 0;
3131
bmp->size = n;
3232
bmp->maskp = calloc(longsperbits(n), sizeof(unsigned long));
33-
if (bmp->maskp == 0) {
33+
if (!bmp->maskp) {
3434
free(bmp);
3535
return 0;
3636
}
@@ -40,7 +40,7 @@ struct bitmask *bitmask_alloc(unsigned int n)
4040
/* Free `struct bitmask` */
4141
void bitmask_free(struct bitmask *bmp)
4242
{
43-
if (bmp == 0)
43+
if (!bmp)
4444
return;
4545
free(bmp->maskp);
4646
bmp->maskp = (unsigned long *)0xdeadcdef; /* double free tripwire */

0 commit comments

Comments
 (0)