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>
This commit is contained in:
Родитель
b3a9e3b962
Коммит
8e022709c4
|
@ -26,11 +26,11 @@ struct bitmask *bitmask_alloc(unsigned int n)
|
||||||
struct bitmask *bmp;
|
struct bitmask *bmp;
|
||||||
|
|
||||||
bmp = malloc(sizeof(*bmp));
|
bmp = malloc(sizeof(*bmp));
|
||||||
if (bmp == 0)
|
if (!bmp)
|
||||||
return 0;
|
return 0;
|
||||||
bmp->size = n;
|
bmp->size = n;
|
||||||
bmp->maskp = calloc(longsperbits(n), sizeof(unsigned long));
|
bmp->maskp = calloc(longsperbits(n), sizeof(unsigned long));
|
||||||
if (bmp->maskp == 0) {
|
if (!bmp->maskp) {
|
||||||
free(bmp);
|
free(bmp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ struct bitmask *bitmask_alloc(unsigned int n)
|
||||||
/* Free `struct bitmask` */
|
/* Free `struct bitmask` */
|
||||||
void bitmask_free(struct bitmask *bmp)
|
void bitmask_free(struct bitmask *bmp)
|
||||||
{
|
{
|
||||||
if (bmp == 0)
|
if (!bmp)
|
||||||
return;
|
return;
|
||||||
free(bmp->maskp);
|
free(bmp->maskp);
|
||||||
bmp->maskp = (unsigned long *)0xdeadcdef; /* double free tripwire */
|
bmp->maskp = (unsigned long *)0xdeadcdef; /* double free tripwire */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче