flash: avoid checking for non NULL pointer to free it
[fw/openocd] / src / flash / nor / ambiqmicro.c
index 622943d284e2ec3a696b3589610d9150b60aacdf..28dc42d8272f8c3903962a4e4bc1471a556c83c0 100644 (file)
@@ -672,10 +672,7 @@ static int ambiqmicro_probe(struct flash_bank *bank)
        if (retval != ERROR_OK)
                return retval;
 
-       if (bank->sectors) {
-               free(bank->sectors);
-               bank->sectors = NULL;
-       }
+       free(bank->sectors);
 
        /* provide this for the benefit of the NOR flash framework */
        bank->size = ambiqmicro_info->pagesize * ambiqmicro_info->num_pages;