From b82a571832ec161ea7b7f5d25f898b309cf68509 Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Thu, 11 Mar 2021 18:18:37 +0200 Subject: [PATCH] util/qualcomm: fix python syntax warnings Don't use 'is' and 'is not' for comparison with literals. This fixes warnings like: .../mbn_tools.py:1097: SyntaxWarning: "is not" with a literal. Did you mean "!="? if int(off) is not 0: Change-Id: Idd68acfcbd1a07cbbb9ab41d9581c4850a431445 Signed-off-by: Baruch Siach Reviewed-on: https://review.coreboot.org/c/coreboot/+/51427 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons Reviewed-by: Julius Werner --- util/qualcomm/mbn_tools.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/util/qualcomm/mbn_tools.py b/util/qualcomm/mbn_tools.py index 73a7d6354a..9abb96c72a 100755 --- a/util/qualcomm/mbn_tools.py +++ b/util/qualcomm/mbn_tools.py @@ -1094,7 +1094,7 @@ def pboot_gen_elf(env, elf_in_file_name, # Check if the vaddr is page aligned off = curr_phdr.p_vaddr & (ELF_BLOCK_ALIGN - 1) - if int(off) is not 0: + if int(off) != 0: seg_size -= (ELF_BLOCK_ALIGN - off) seg_offset += (ELF_BLOCK_ALIGN - off) @@ -1163,7 +1163,7 @@ def pboot_gen_elf(env, elf_in_file_name, # Error checking for hash segment size validity if hashtable_size > hash_seg_max_size: raise RuntimeError("Hash table exceeds maximum hash segment size: " + hex(hash_seg_max_size)) - if (hash_seg_max_size & (ELF_BLOCK_ALIGN-1)) is not 0: + if (hash_seg_max_size & (ELF_BLOCK_ALIGN-1)) != 0: raise RuntimeError("Hash segment size passed is not ELF Block Aligned: " + hex(hash_seg_max_size)) # Check if hash physical address parameter was passed @@ -1646,7 +1646,7 @@ def readSCL(filename, global_dict): # Look for the symbol '{' for the line to read. # Use bracket counter to skip nested '{ }' if ('{' in current_line): - if bracket_counter is 0: + if bracket_counter == 0: # Create a new SegmentInfo class and set up tokens new_scl_entry = SegmentInfo() previous_line = previous_line.strip() @@ -1702,7 +1702,7 @@ def getSegmentFlag(seg_info): PAGELOCKED = "PAGELOCKED" UNSECURE = "UNSECURE" - if seg_info is None or len(seg_info) is 0: + if seg_info is None or len(seg_info) == 0: raise RuntimeError('Invalid segment information passed: ' + seg_info) # Conditional checks and assignments of the corresponding segment flag values @@ -1947,9 +1947,9 @@ def filter_dictionary(env, global_dict, **kwargs): id_mbn_type = image_id_table[image_type][2] # Handle MBN Type and assign image destination address - if id_mbn_type is 'elf': + if id_mbn_type == 'elf': pass - elif id_mbn_type is 'bin': + elif id_mbn_type == 'bin': template_key_match = 'IMAGE_KEY_' + id_match_str + "_DEST_ADDR" if template_key_match in global_dict: image_dest = global_dict[template_key_match]