From 257658cbcafdb382a1ee56c89ef04b81f0d0ba1f Mon Sep 17 00:00:00 2001 From: "Leder, Brendan Steve" Date: Tue, 17 Sep 2024 20:55:36 -0400 Subject: [PATCH] amd/vpelib: Fix backend bug for multiple instances Fix potential duplicated config if config_writer_complete is called multiple times Reviewed-by: Roy Chan Reviewed-by: Evan Damphousse Acked-by: Chih-Wei Chien Signed-off-by: Brendan Leder Part-of: --- src/amd/vpelib/src/core/config_writer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/amd/vpelib/src/core/config_writer.c b/src/amd/vpelib/src/core/config_writer.c index d1f92ef2fc7..a153a7291c6 100644 --- a/src/amd/vpelib/src/core/config_writer.c +++ b/src/amd/vpelib/src/core/config_writer.c @@ -103,7 +103,7 @@ void config_writer_set_type(struct config_writer *writer, enum config_type type, if (writer->status != VPE_STATUS_OK) return; - if (writer->type != type) { + if ((writer->type != type) || (writer->pipe_idx != pipe_idx)) { if (writer->type == CONFIG_TYPE_UNKNOWN) { // new header or only pipe change. don't need to fill it yet until completion writer->pipe_idx = pipe_idx; @@ -281,6 +281,9 @@ void config_writer_complete(struct config_writer *writer) if (size <= sizeof(uint32_t)) { config_writer_reset(writer); return; + } else if (writer->completed == true) { + // completed has already been called for this packet + return; } if (writer->status != VPE_STATUS_OK)