2023-02-25 06:42:02

by Saravana Kannan

[permalink] [raw]
Subject: [PATCH v1] 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")
Reported-by: Vladimir Oltean <[email protected]>
Reported-by: Dmitry Baryshkov <[email protected]>
Signed-off-by: Saravana Kannan <[email protected]>
---
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



2023-02-27 13:03:40

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v1] driver core: fw_devlink: Avoid spurious error message

On Sat, Feb 25, 2023 at 7:41 AM Saravana Kannan <[email protected]> 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 <[email protected]>
> Reported-by: Dmitry Baryshkov <[email protected]>
> Signed-off-by: Saravana Kannan <[email protected]>

Acked-by: Rafael J. Wysocki <[email protected]>

> ---
> 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
>

2023-10-02 18:52:59

by Root Mailer

[permalink] [raw]
Subject: Re: [PATCH v1] driver core: fw_devlink: Avoid spurious error message

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