diff mbox series

[v2,5/5] firmware: arm_scmi: Exclude transport devices from bus matching

Message ID 20250317-b4-scmi_minor_cleanup-v2-5-f4be99bd9864@arm.com (mailing list archive)
State New
Headers show
Series firmware: arm_scmi: Minor cleanups in the scmi bus layer | expand

Commit Message

Sudeep Holla March 17, 2025, 10:31 a.m. UTC
Transport devices are currently being unintentionally matched to
drivers with the same name, allowing their probe function to be
invoked. However, the bus notifier prevents them from setting up
handles, rendering them unable to utilize SCMI core functionality.

Instead of relying on the bus notifier which can't prevent bus matching
even if it returns early or error, move the check into the bus matching
logic itself. This change ensures that transport devices are entirely
excluded from driver matching, preventing any unintended probe attempts.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_scmi/bus.c    | 2 ++
 drivers/firmware/arm_scmi/driver.c | 5 ++---
 2 files changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
index 493e2c63b107fd9063f11034b71d65f567bb0778..17b0e6e2cb0a65d88079346b3da319ce6356b42b 100644
--- a/drivers/firmware/arm_scmi/bus.c
+++ b/drivers/firmware/arm_scmi/bus.c
@@ -212,8 +212,10 @@  static int scmi_dev_match_by_id_table(struct scmi_device *scmi_dev,
 	if (!id_table || !id_table->name)
 		return 0;
 
+	/* Always skip transport devices from matching */
 	for (; id_table->protocol_id && id_table->name; id_table++)
 		if (id_table->protocol_id == scmi_dev->protocol_id &&
+		    strncmp(scmi_dev->name, "__scmi_transport_device", 23) &&
 		    !strcmp(id_table->name, scmi_dev->name))
 			return 1;
 	return 0;
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index b80c574cb3bb2f12b2980fc844ea3da10abdc9f1..2b567f29c83493487b8b0998886dcf75827017ef 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -2829,9 +2829,8 @@  static int scmi_bus_notifier(struct notifier_block *nb,
 	struct scmi_info *info = bus_nb_to_scmi_info(nb);
 	struct scmi_device *sdev = to_scmi_dev(data);
 
-	/* Skip transport devices and devices of different SCMI instances */
-	if (!strncmp(sdev->name, "__scmi_transport_device", 23) ||
-	    sdev->dev.parent != info->dev)
+	/* Skip devices of different SCMI instances */
+	if (sdev->dev.parent != info->dev)
 		return NOTIFY_DONE;
 
 	switch (action) {