[RFC 1/6] firmware: scmi: fix protocol enumeration logic

AKASHI Takahiro takahiro.akashi at linaro.org
Wed Sep 6 04:40:06 CEST 2023


The original logic in enumerating all the protocols accidentally
modifies a *loop* variable, node, at Voltage domain protocol.
So subsequent protocol nodes in a device tree won't be detected.

Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
---
 drivers/firmware/scmi/scmi_agent-uclass.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c
index 46a2933d51a4..79584c00a066 100644
--- a/drivers/firmware/scmi/scmi_agent-uclass.c
+++ b/drivers/firmware/scmi/scmi_agent-uclass.c
@@ -422,8 +422,11 @@ static int scmi_bind_protocols(struct udevice *dev)
 		case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
 			if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI) &&
 			    scmi_protocol_is_supported(dev, protocol_id)) {
-				node = ofnode_find_subnode(node, "regulators");
-				if (!ofnode_valid(node)) {
+				ofnode sub_node;
+
+				sub_node = ofnode_find_subnode(node,
+							       "regulators");
+				if (!ofnode_valid(sub_node)) {
 					dev_err(dev, "no regulators node\n");
 					return -ENXIO;
 				}
-- 
2.34.1



More information about the U-Boot mailing list