From 37050bfd4b509b5b0d0134028cf3297312e6da91 Mon Sep 17 00:00:00 2001 From: Mahmoud Elsabbagh Date: Wed, 9 Apr 2025 14:52:59 +0100 Subject: [PATCH] mod_scmi: Fix logically dead code error Fix logically dead code error, where ctx is just assigned and then checked if its equal NULL, so the if statement is dead code as ctx is never equall NULL. Signed-off-by: Mahmoud Elsabbagh --- module/scmi/src/mod_scmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/scmi/src/mod_scmi.c b/module/scmi/src/mod_scmi.c index ac8b0e9e4..d4f6c6666 100644 --- a/module/scmi/src/mod_scmi.c +++ b/module/scmi/src/mod_scmi.c @@ -477,9 +477,10 @@ static void scmi_notify(fwk_id_t id, int protocol_id, int message_id, } ctx = &scmi_ctx.service_ctx_table[fwk_id_get_element_idx(id)]; - if (ctx == NULL) { + if ((ctx == NULL) || (ctx->config == NULL)) { return; } + /* ctx is the original A2P service channel */ if (fwk_id_is_equal(ctx->config->scmi_p2a_id, FWK_ID_NONE)) { return; @@ -535,8 +536,7 @@ int scmi_send_message( const struct mod_scmi_to_transport_api *transport_api; const struct scmi_service_ctx *ctx; ctx = &scmi_ctx.service_ctx_table[fwk_id_get_element_idx(service_id)]; - - if (ctx == NULL) { + if ((ctx == NULL) || (ctx->transport_api == NULL)) { return FWK_E_DATA; } -- GitLab