]> git.baikalelectronics.ru Git - kernel.git/commitdiff
driver core: fw_devlink: Avoid spurious error message
authorSaravana Kannan <saravanak@google.com>
Sat, 25 Feb 2023 06:41:47 +0000 (22:41 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:34:01 +0000 (09:34 +0100)
[ Upstream commit b42a27352e04b5f0e01c17a19505257166b1bd0b ]

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: 9a2a98c0e4dc ("driver core: fw_devlink: Make cycle detection more robust")
Reported-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reported-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Saravana Kannan <saravanak@google.com>
Link: https://lore.kernel.org/r/20230225064148.274376-1-saravanak@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/base/core.c

index ac08d475e2828f0788dcf5a94dfb871114159554..e30223c2672fc792b973794866c03653f36c25d2 100644 (file)
@@ -2087,9 +2087,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;
                }