diff mbox series

libpdbg: Ensure threads are probed prior to setup in ram_setup

Message ID 20180809073751.9404-1-alistair@popple.id.au
State Accepted
Headers show
Series libpdbg: Ensure threads are probed prior to setup in ram_setup | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/build-multiarch success Test build-multiarch on branch master

Commit Message

Alistair Popple Aug. 9, 2018, 7:37 a.m. UTC
p9chip.c called the probe function directly. Better to call pdbg_target_probe()
so that any intermediate targets can also be probed.

p8chip.c didn't probe the threads at all prior to use, so do that.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
 libpdbg/p8chip.c | 6 ++++++
 libpdbg/p9chip.c | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c
index 3e90c8d..2638725 100644
--- a/libpdbg/p8chip.c
+++ b/libpdbg/p8chip.c
@@ -300,6 +300,12 @@  static int p8_ram_setup(struct thread *thread)
 	 * quiesced */
 	dt_for_each_compatible(&chip->target, target, "ibm,power8-thread") {
 		struct thread *tmp;
+
+		/* If this thread wasn't enabled it may not yet have been probed
+		   so do that now. This will also update the thread status */
+		if (pdbg_target_probe(target) != PDBG_TARGET_ENABLED)
+			return 1;
+
 		tmp = target_to_thread(target);
 		if (!(get_thread_status(tmp).quiesced))
 			return 1;
diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c
index 1433d19..dcdb69d 100644
--- a/libpdbg/p9chip.c
+++ b/libpdbg/p9chip.c
@@ -227,7 +227,9 @@  static int p9_ram_setup(struct thread *thread)
 
 		/* If this thread wasn't enabled it may not yet have been probed
 		   so do that now. This will also update the thread status */
-		p9_thread_probe(target);
+		if (pdbg_target_probe(target) != PDBG_TARGET_ENABLED)
+			goto out_fail;
+
 		tmp = target_to_thread(target);
 		if (!(tmp->status.quiesced))
 			goto out_fail;