[PATCH] avoid to use NULL pointer

Monk Liu Monk.Liu at amd.com
Fri Feb 14 08:25:02 UTC 2020


Signed-off-by: Monk Liu <Monk.Liu at amd.com>
---
 src/lib/umr_read_pm4_stream.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/lib/umr_read_pm4_stream.c b/src/lib/umr_read_pm4_stream.c
index 60bea49..317b638 100644
--- a/src/lib/umr_read_pm4_stream.c
+++ b/src/lib/umr_read_pm4_stream.c
@@ -325,6 +325,9 @@ int umr_pm4_decode_ring_is_halted(struct umr_asic *asic, char *ringname)
 	// since the kernel returned values might be unwrapped.
 	for (n = 0; n < 100; n++) {
 		ringdata = umr_read_ring_data(asic, ringname, &ringsize);
+		if (!ringdata)
+			return 1;
+
 		ringsize /= 4;
 		ringdata[0] %= ringsize;
 		ringdata[1] %= ringsize;
-- 
2.7.4



More information about the amd-gfx mailing list