diff mbox series

HID: amd_sfh: Don't show client init failed as error when discovery fails

Message ID 20220512180043.26206-1-mario.limonciello@amd.com (mailing list archive)
State Superseded
Delegated to: Jiri Kosina
Headers show
Series HID: amd_sfh: Don't show client init failed as error when discovery fails | expand

Commit Message

Mario Limonciello May 12, 2022, 6 p.m. UTC
When sensor discovery fails, this means that the system doesn't have
any sensors connected and a user should only be notified at most one time.
A message is already displayed at WARN level of "failed ot discover,
sensors not enabled".  It's pointless to show that the client init failed
at ERR level for the same condition.

Check the return code and don't display this message in thoes conditions.

Fixes: b5d7f43e97da ("HID: amd_sfh: Add support for sensor discovery")
Reported-by: David Chang <David.Chang@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Basavaraj Natikar May 12, 2022, 6:16 p.m. UTC | #1
On 5/12/2022 11:30 PM, Mario Limonciello wrote:

> When sensor discovery fails, this means that the system doesn't have
> any sensors connected and a user should only be notified at most one time.
> A message is already displayed at WARN level of "failed ot discover,

s/failed ot/Failed to

> sensors not enabled".  It's pointless to show that the client init failed
> at ERR level for the same condition.
>
> Check the return code and don't display this message in thoes conditions.

s/thoes/those

Thanks,
Basavaraj

>
> Fixes: b5d7f43e97da ("HID: amd_sfh: Add support for sensor discovery")
> Reported-by: David Chang <David.Chang@amd.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
> index dadc491bbf6b..1441787a154a 100644
> --- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
> +++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
> @@ -327,7 +327,8 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
>  	rc = amd_sfh_hid_client_init(privdata);
>  	if (rc) {
>  		amd_sfh_clear_intr(privdata);
> -		dev_err(&pdev->dev, "amd_sfh_hid_client_init failed\n");
> +		if (rc != -EOPNOTSUPP)
> +			dev_err(&pdev->dev, "amd_sfh_hid_client_init failed\n");
>  		return rc;
>  	}
>
diff mbox series

Patch

diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index dadc491bbf6b..1441787a154a 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -327,7 +327,8 @@  static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
 	rc = amd_sfh_hid_client_init(privdata);
 	if (rc) {
 		amd_sfh_clear_intr(privdata);
-		dev_err(&pdev->dev, "amd_sfh_hid_client_init failed\n");
+		if (rc != -EOPNOTSUPP)
+			dev_err(&pdev->dev, "amd_sfh_hid_client_init failed\n");
 		return rc;
 	}