platform-mc: Clarify SetTID failure logging
Simplify the failure path to a single branch:
when SetTID fails, emit a specific message for devices that do not
support the command; otherwise report a general failure.
Motivation:
Remove unreachable and contradictory checks and make failure messages
clearer without altering behavior.
Change-Id: Ia8a0dfbdbc451fa2f2a173ae8b11d1dedef9fd27
Signed-off-by: Eric Yang <eric.yang.wiwynn@gmail.com>
diff --git a/platform-mc/terminus_manager.cpp b/platform-mc/terminus_manager.cpp
index 0de6ce9..bcbbb95 100644
--- a/platform-mc/terminus_manager.cpp
+++ b/platform-mc/terminus_manager.cpp
@@ -343,16 +343,17 @@
rc = co_await setTidOverMctp(eid, tid);
if (rc != PLDM_SUCCESS)
{
- lg2::error("Failed to Set terminus TID, error{ERROR}.", "ERROR",
- rc);
- unmapTid(tid);
- co_return rc;
- }
-
- if (rc != PLDM_SUCCESS && rc != PLDM_ERROR_UNSUPPORTED_PLDM_CMD)
- {
- lg2::error("Terminus {TID} does not support SetTID command.", "TID",
- tid);
+ if (rc == PLDM_ERROR_UNSUPPORTED_PLDM_CMD)
+ {
+ lg2::error("Terminus {TID} does not support SetTID command.",
+ "TID", tid);
+ }
+ else
+ {
+ lg2::error(
+ "Failed to Set terminus TID for terminus {TID}, error {ERROR}.",
+ "TID", tid, "ERROR", rc);
+ }
unmapTid(tid);
co_return rc;
}