mirror of https://github.com/thesofproject/sof.git
tools: logger: avoid NULL comparison
Change suggested by coccinelle. Avoid NULL comparison, compare using boolean operator. Signed-off-by: Payal Kshirsagar <payalskshirsagar1234@gmail.com>
This commit is contained in:
parent
22be53b98a
commit
66fd8cefba
|
@ -465,7 +465,7 @@ static int fetch_entry(const struct convert_config *config,
|
|||
goto out;
|
||||
}
|
||||
entry.text = (char *)malloc(entry.header.text_len);
|
||||
if (entry.text == NULL) {
|
||||
if (!entry.text) {
|
||||
log_err(config->out_fd,
|
||||
"can't allocate %d byte for entry.text\n",
|
||||
entry.header.text_len);
|
||||
|
@ -487,7 +487,7 @@ static int fetch_entry(const struct convert_config *config,
|
|||
}
|
||||
entry.params = (uint32_t *)malloc(sizeof(uint32_t) *
|
||||
entry.header.params_num);
|
||||
if (entry.params == NULL) {
|
||||
if (!entry.params) {
|
||||
log_err(config->out_fd,
|
||||
"can't allocate %d byte for entry.params\n",
|
||||
(int)(sizeof(uint32_t) * entry.header.params_num));
|
||||
|
|
|
@ -63,7 +63,7 @@ static int snapshot(const char *name)
|
|||
FILE *in_fd, *out_fd;
|
||||
int i, count;
|
||||
|
||||
if (name == NULL) {
|
||||
if (!name) {
|
||||
fprintf(stderr, "error: need snapshot name\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ static int snapshot(const char *name)
|
|||
|
||||
/* open debugfs for reading */
|
||||
in_fd = fopen(pinname, "rb");
|
||||
if (in_fd == NULL) {
|
||||
if (!in_fd) {
|
||||
fprintf(stderr, "error: unable to open %s for reading %d\n",
|
||||
pinname, errno);
|
||||
continue;
|
||||
|
@ -83,7 +83,7 @@ static int snapshot(const char *name)
|
|||
|
||||
/* open outfile for writing */
|
||||
out_fd = fopen(poutname, "wb");
|
||||
if (out_fd == NULL) {
|
||||
if (!out_fd) {
|
||||
fprintf(stderr, "error: unable to open %s for writing %d\n",
|
||||
poutname, errno);
|
||||
fclose(in_fd);
|
||||
|
|
Loading…
Reference in New Issue