The BASE_DISCOVER_AGENT command is an optional command which may not be
defined on the server side. Calling it without first checking if it is
implemented will at the very best print ERROR: messages from the server
about the command not being implemented.

Fix this by first using the PROTOCOL_MESSAGE_ATTRIBUTES command to
discover if the command is defined before we use BASE_DISCOVER_AGENT.

Signed-off-by: Bryan Brattlof <[email protected]>
---
 drivers/firmware/scmi/base.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/firmware/scmi/base.c b/drivers/firmware/scmi/base.c
index 78ee2ffd2dae..fd65eae3cb41 100644
--- a/drivers/firmware/scmi/base.c
+++ b/drivers/firmware/scmi/base.c
@@ -338,8 +338,13 @@ static int scmi_base_discover_agent_int(struct udevice 
*dev, u32 agent_id,
                .out_msg = (u8 *)&out,
                .out_msg_sz = sizeof(out),
        };
+       u32 dummy;
        int ret;
 
+       ret = scmi_protocol_message_attrs_int(dev, SCMI_BASE_DISCOVER_AGENT, 
&dummy);
+       if (ret)
+               return -EOPNOTSUPP;
+
        ret = devm_scmi_process_msg(dev, &msg);
        if (ret)
                return ret;

---
base-commit: 8d534cec0cc0109a37c0ded8854da03f1526dc0e
change-id: 20261016-base-discover-agent-fix-d6e0e2ca6332

Best regards,
--  
Bryan Brattlof <[email protected]>

Reply via email to