openocd: fix simple cases of NULL comparison
[fw/openocd] / src / flash / nor / stm32h7x.c
index 16ab6aeb7eba4286b0f6b86e59de431e421c5f3e..5c71d31f06653f30742dbc722b68846287f73571 100644 (file)
@@ -879,7 +879,7 @@ static int stm32x_probe(struct flash_bank *bank)
        bank->sectors = alloc_block_array(0, stm32x_info->part_info->page_size_kb * 1024,
                        bank->num_sectors);
 
-       if (bank->sectors == NULL) {
+       if (!bank->sectors) {
                LOG_ERROR("failed to allocate bank sectors");
                return ERROR_FAIL;
        }
@@ -896,7 +896,7 @@ static int stm32x_probe(struct flash_bank *bank)
        bank->prot_blocks = alloc_block_array(0, stm32x_info->part_info->page_size_kb * wpsn * 1024,
                        bank->num_prot_blocks);
 
-       if (bank->prot_blocks == NULL) {
+       if (!bank->prot_blocks) {
                LOG_ERROR("failed to allocate bank prot_block");
                return ERROR_FAIL;
        }
@@ -937,7 +937,7 @@ static int stm32x_get_info(struct flash_bank *bank, struct command_invocation *c
                        if (rev_id == info->revs[i].rev)
                                rev_str = info->revs[i].str;
 
-               if (rev_str != NULL) {
+               if (rev_str) {
                        command_print_sameline(cmd, "%s - Rev: %s",
                                stm32x_info->part_info->device_str, rev_str);
                } else {