openocd: src: fix incorrect SPDX tags
[openocd.git] / src / flash / nor / msp432.c
index 23d4982f40e1c7e4164a81c612867871c88fa614..61741c8d6811a85f0c8c958f054ac85e58892593 100644 (file)
@@ -209,7 +209,7 @@ static int msp432_wait_return_code(struct target *target)
        int retval = ERROR_OK;
 
        start_ms = timeval_ms();
-       while ((0 == return_code) || (return_code == FLASH_BUSY)) {
+       while ((return_code == 0) || (return_code == FLASH_BUSY)) {
                retval = target_read_u32(target, ALGO_RETURN_CODE_ADDR, &return_code);
                if (retval != ERROR_OK)
                        return retval;
@@ -322,11 +322,11 @@ static int msp432_init(struct flash_bank *bank)
                        "msp432: Unrecognized MSP432P4 Device ID and Hardware "
                        "Rev (%04" PRIX32 ", %02" PRIX32 ")", msp432_bank->device_id,
                        msp432_bank->hardware_rev);
-       } else if (MSP432P401X_DEPR == msp432_bank->device_type) {
+       } else if (msp432_bank->device_type == MSP432P401X_DEPR) {
                LOG_WARNING(
                        "msp432: MSP432P401x pre-production device (deprecated "
                        "silicon)\n" SUPPORT_MESSAGE);
-       } else if (MSP432E4X_GUESS == msp432_bank->device_type) {
+       } else if (msp432_bank->device_type == MSP432E4X_GUESS) {
                /* Explicit device type check failed. Report this. */
                LOG_WARNING(
                        "msp432: Unrecognized MSP432E4 DID0 and DID1 values "
@@ -335,15 +335,16 @@ static int msp432_init(struct flash_bank *bank)
        }
 
        /* Check for working area to use for flash helper algorithm */
-       if (msp432_bank->working_area)
-               target_free_working_area(target, msp432_bank->working_area);
+       target_free_working_area(target, msp432_bank->working_area);
+       msp432_bank->working_area = NULL;
+
        retval = target_alloc_working_area(target, ALGO_WORKING_SIZE,
                                &msp432_bank->working_area);
        if (retval != ERROR_OK)
                return retval;
 
        /* Confirm the defined working address is the area we need to use */
-       if (ALGO_BASE_ADDR != msp432_bank->working_area->address)
+       if (msp432_bank->working_area->address != ALGO_BASE_ADDR)
                return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
 
        /* Write flash helper algorithm into target memory */
@@ -432,7 +433,7 @@ static int msp432_mass_erase(struct flash_bank *bank, bool all)
 
        int retval;
 
-       if (TARGET_HALTED != target->state) {
+       if (target->state != TARGET_HALTED) {
                LOG_ERROR("Target not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
@@ -501,7 +502,7 @@ COMMAND_HANDLER(msp432_mass_erase_command)
 
        msp432_bank = bank->driver_priv;
 
-       if (MSP432E4 == msp432_bank->family_type) {
+       if (msp432_bank->family_type == MSP432E4) {
                /* MSP432E4 does not have main vs info regions, ignore "all" */
                all = false;
        }
@@ -510,7 +511,7 @@ COMMAND_HANDLER(msp432_mass_erase_command)
        if (retval != ERROR_OK)
                return retval;
 
-       if (MSP432E4 == msp432_bank->family_type) {
+       if (msp432_bank->family_type == MSP432E4) {
                /* MSP432E4 does not have main vs info regions */
                LOG_INFO("msp432: Mass erase of flash is complete");
        } else {
@@ -537,7 +538,7 @@ COMMAND_HANDLER(msp432_bsl_command)
 
        msp432_bank = bank->driver_priv;
 
-       if (MSP432E4 == msp432_bank->family_type) {
+       if (msp432_bank->family_type == MSP432E4) {
                LOG_WARNING("msp432: MSP432E4 does not have a BSL region");
                return ERROR_OK;
        }
@@ -602,7 +603,7 @@ static int msp432_erase(struct flash_bank *bank, unsigned int first,
 
        int retval;
 
-       if (TARGET_HALTED != target->state) {
+       if (target->state != TARGET_HALTED) {
                LOG_ERROR("Target not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
@@ -680,7 +681,7 @@ static int msp432_write(struct flash_bank *bank, const uint8_t *buffer,
 
        int retval;
 
-       if (TARGET_HALTED != target->state) {
+       if (target->state != TARGET_HALTED) {
                LOG_ERROR("Target not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
@@ -829,7 +830,7 @@ static int msp432_probe(struct flash_bank *bank)
        if (retval != ERROR_OK)
                return retval;
 
-       if (0 == size) {
+       if (size == 0) {
                /* This is likely an MSP432E4 */
                msp432_bank->family_type = MSP432E4;
 
@@ -864,7 +865,7 @@ static int msp432_probe(struct flash_bank *bank)
        msp432_bank->device_type = msp432_device_type(msp432_bank->family_type,
                msp432_bank->device_id, msp432_bank->hardware_rev);
 
-       if (MSP432P4 == msp432_bank->family_type) {
+       if (msp432_bank->family_type == MSP432P4) {
                /* Set up MSP432P4 specific flash parameters */
                if (is_main) {
                        retval = target_read_u32(target, P4_FLASH_MAIN_SIZE_REG, &size);
@@ -981,7 +982,7 @@ static int msp432_info(struct flash_bank *bank, struct command_invocation *cmd)
 
        switch (msp432_bank->device_type) {
                case MSP432P401X_DEPR:
-                       if (0xFFFF == msp432_bank->device_id) {
+                       if (msp432_bank->device_id == 0xFFFF) {
                                /* Very early pre-production silicon currently deprecated */
                                command_print_sameline(cmd, "MSP432P401x pre-production device (deprecated silicon)\n"
                                        SUPPORT_MESSAGE);

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)