|
From: openocd-gerrit <ope...@us...> - 2026-09-13 04:51:45
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via fee41114fc652d6058b8c015db4c659d0464f852 (commit)
from d3e5f5787bea40f5f13c869647deb44b4c051ae0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit fee41114fc652d6058b8c015db4c659d0464f852
Author: Tomas Vanek <va...@fb...>
Date: Fri Sep 4 14:43:12 2026 +0200
flash/nor: make free_driver_priv method optional
Currently 62 of 68 flash drivers define
.free_driver_priv = default_free_driver_priv
Fall back to default_free_driver_priv() if the .free_driver_priv
method is NULL
Change-Id: I3e9ab4168a1076823375b671e9fa67ad6bbca29e
Signed-off-by: Tomas Vanek <va...@fb...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9961
Reviewed-by: Antonio Borneo <bor...@gm...>
Tested-by: jenkins
diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c
index 2c41d1853..93c8b7124 100644
--- a/src/flash/nor/core.c
+++ b/src/flash/nor/core.c
@@ -221,7 +221,7 @@ void flash_free_all_banks(void)
if (bank->driver->free_driver_priv)
bank->driver->free_driver_priv(bank);
else
- LOG_WARNING("Flash driver of %s does not support free_driver_priv()", bank->name);
+ default_flash_free_driver_priv(bank);
free(bank->sectors);
free(bank->prot_blocks);
diff --git a/src/flash/nor/driver.h b/src/flash/nor/driver.h
index 6f66f7f0a..48cf2ad36 100644
--- a/src/flash/nor/driver.h
+++ b/src/flash/nor/driver.h
@@ -219,8 +219,12 @@ struct flash_driver {
int (*auto_probe)(struct flash_bank *bank);
/**
- * Deallocates private driver structures.
- * Use default_flash_free_driver_priv() to simply free(bank->driver_priv)
+ * Deallocates private driver structures at exit.
+ *
+ * If the driver does not use driver_priv and keeps it NULL
+ * or allocates just one memory block referenced in driver_priv,
+ * set the method to NULL: default_flash_free_driver_priv() will
+ * simply free(bank->driver_priv) at exit.
*
* @param bank - the bank being destroyed
*/
-----------------------------------------------------------------------
Summary of changes:
src/flash/nor/core.c | 2 +-
src/flash/nor/driver.h | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|