target,flash: allow target_free_working_area on NULL area pointer
Standard C library free() allows NULL pointer as a parameter. Change target_free_working_area() to conform this convention. Remove NULL pointer tests before target_free_working_area() calls. While on it add missing setting pointer to NULL after target_free_working_area(). Change-Id: I7c692ab04a9933398ba5bc614723ad0bdecb87b3 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6712 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
committed by
Antonio Borneo
parent
35f284fe7c
commit
f735faa931
@@ -703,11 +703,14 @@ static int sh_qspi_upload_helper(struct flash_bank *bank)
|
||||
};
|
||||
int ret;
|
||||
|
||||
if (info->source)
|
||||
target_free_working_area(target, info->source);
|
||||
if (info->io_algorithm)
|
||||
target_free_working_area(target, info->io_algorithm);
|
||||
target_free_working_area(target, info->source);
|
||||
target_free_working_area(target, info->io_algorithm);
|
||||
|
||||
/* FIXME: Working areas are allocated during flash probe
|
||||
* and eventual target_free_all_working_areas() called in case
|
||||
* of target reset or run is not handled at all.
|
||||
* Not a big problem if area backp is off.
|
||||
*/
|
||||
/* flash write code */
|
||||
if (target_alloc_working_area(target, sizeof(sh_qspi_io_code),
|
||||
&info->io_algorithm) != ERROR_OK) {
|
||||
|
||||
Reference in New Issue
Block a user