[Pdbg] [PATCH 2/2] libpdbg: Add explicit check for library initialisation
Amitay Isaacs
amitay at ozlabs.org
Wed Apr 22 12:17:31 AEST 2020
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
libpdbg/device.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libpdbg/device.c b/libpdbg/device.c
index 219569e..80a8287 100644
--- a/libpdbg/device.c
+++ b/libpdbg/device.c
@@ -709,6 +709,11 @@ bool pdbg_targets_init(void *fdt)
{
struct pdbg_dtb *dtb;
+ if (pdbg_dt_root) {
+ pdbg_log(PDBG_ERROR, "pdbg_targets_init() must be called only once\n");
+ return false;
+ }
+
dtb = pdbg_default_dtb(fdt);
if (!dtb) {
--
2.25.3
More information about the Pdbg
mailing list