Skip to contentSkip to conversation

driver core: fw_devlink: Avoid spurious error message

PATCH In review Saravana Kannan 2 participants 2 messages Feb 25, 2023 – Feb 27, 2023 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver core: fw_devlink: Avoid spurious error message

fw_devlink can sometimes try to create a device link with the consumer and supplier as the same device. These attempts will fail (correctly), but are harmless. So, avoid printing an error for these cases. Also, add more detail to the error message.

Fixes 3fb16866b51d ("driver core: fw_devlink: Make cycle detection more robust")
---
 drivers/base/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/base/core.c +3 -3
index f9297c68214a..4f02a10f802f 100644
@@ -2088,9 +2088,9 @@ static int fw_devlink_create_devlink(struct device *con,
 			goto out;
 		}
 
-		if (!device_link_add(con, sup_dev, flags)) {
-			dev_err(con, "Failed to create device link with %s\n",
-				dev_name(sup_dev));
+		if (con != sup_dev && !device_link_add(con, sup_dev, flags)) {
+			dev_err(con, "Failed to create device link (0x%x) with %s\n",
+				flags, dev_name(sup_dev));
 			ret = -EINVAL;
 		}
 
Signature · 1 line
2.39.2.637.g21b0678d19-goog
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Saravana Kannan

fw_devlink can sometimes try to create a device link with the consumer and supplier as the same device. These attempts will fail (correctly), but are harmless. So, avoid printing an error for these cases. Also, add more detail to the error message.

Fixes 3fb16866b51d ("driver core: fw_devlink: Make cycle detection more robust")
Quoted 24 lines
---
 drivers/base/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/base/core.c +3 -4
index f9297c68214a..4f02a10f802f 100644
@@ -2088,9 +2088,9 @@ static int fw_devlink_create_devlink(struct device *con,
                        goto out;
                }
 
-               if (!device_link_add(con, sup_dev, flags)) {
-                       dev_err(con, "Failed to create device link with %s\n",
-                               dev_name(sup_dev));
+               if (con != sup_dev && !device_link_add(con, sup_dev, flags)) {
+                       dev_err(con, "Failed to create device link (0x%x) with %s\n",
+                               flags, dev_name(sup_dev));
                        ret = -EINVAL;
                }
 
--

2.39.2.637.g21b0678d19-goog