linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] driver core: fw_devlink: Avoid spurious error message
@ 2023-02-25  6:41 Saravana Kannan
  2023-02-27 13:03 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Saravana Kannan @ 2023-02-25  6:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Saravana Kannan
  Cc: Vladimir Oltean, Dmitry Baryshkov, kernel-team, linux-kernel

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")
Reported-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reported-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/base/core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index f9297c68214a..4f02a10f802f 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] driver core: fw_devlink: Avoid spurious error message
  2023-02-25  6:41 [PATCH v1] driver core: fw_devlink: Avoid spurious error message Saravana Kannan
@ 2023-02-27 13:03 ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2023-02-27 13:03 UTC (permalink / raw)
  To: Saravana Kannan
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Vladimir Oltean,
	Dmitry Baryshkov, kernel-team, linux-kernel

On Sat, Feb 25, 2023 at 7:41 AM Saravana Kannan <saravanak@google.com> wrote:
>
> 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")
> Reported-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> Reported-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Saravana Kannan <saravanak@google.com>

Acked-by: Rafael J. Wysocki <rafael@kernel.org>

> ---
>  drivers/base/core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index f9297c68214a..4f02a10f802f 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] driver core: fw_devlink: Avoid spurious error message
@ 2023-10-02 14:18 Root Mailer
  0 siblings, 0 replies; 3+ messages in thread
From: Root Mailer @ 2023-10-02 14:18 UTC (permalink / raw)
  To: saravanak
  Cc: dmitry.baryshkov, gregkh, kernel-team, linux-kernel, rafael,
	vladimir.oltean

In the commit message it says

"So, avoid printing an error for these cases."

yet dev_err() is used instead of dev_warn(). As it is harmless,
dev_warn() should be used here otherwise this confuses people.

Best regards

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-02 14:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-25  6:41 [PATCH v1] driver core: fw_devlink: Avoid spurious error message Saravana Kannan
2023-02-27 13:03 ` Rafael J. Wysocki
2023-10-02 14:18 Root Mailer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).