2018-09-07 23:35:49

by Luiz Carlos Ramos

[permalink] [raw]
Subject: [PATCH] ath3k: add warning when switch pid is not working

This patch adds a warning message in the ath3k driver when
ath3k_switch_pid() returns error.

This event happens in a specific laptop, with an adapter which
identifies itself as 0cf3:0036. Surprisingly, the adapter works even
after this event - hence a warning is chosen instead of an error.

The current version of ath3k doesn't check the return value of
ath3k_switch_pid() and so this event may remain undetected in the
original version.

Signed-off-by: Luiz Carlos Ramos <[email protected]>
---
drivers/bluetooth/ath3k.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 3d7a5c149af3..3a8c47efea55 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -546,7 +546,10 @@ static int ath3k_probe(struct usb_interface *intf,
BT_ERR("Set normal mode failed");
return ret;
}
- ath3k_switch_pid(udev);
+ ret = ath3k_switch_pid(udev);
+ if (ret < 0)
+ BT_WARN("Warning: switch pid failed (ret=%d)", ret);
+
return 0;
}

--
2.14.4


2018-09-27 10:48:20

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH] ath3k: add warning when switch pid is not working

Hi Luiz,

> This patch adds a warning message in the ath3k driver when
> ath3k_switch_pid() returns error.
>
> This event happens in a specific laptop, with an adapter which
> identifies itself as 0cf3:0036. Surprisingly, the adapter works even
> after this event - hence a warning is chosen instead of an error.
>
> The current version of ath3k doesn't check the return value of
> ath3k_switch_pid() and so this event may remain undetected in the
> original version.

if works anyway, why bother with a warning? I have no idea what benefit this has.

Regards

Marcel


2018-09-27 16:14:49

by Luiz Carlos Ramos

[permalink] [raw]
Subject: Re: [PATCH] ath3k: add warning when switch pid is not working

Hi, Marcel,

On Thu, Sep 27, 2018 at 12:48:17PM +0200, Marcel Holtmann wrote:
> Hi Luiz,
>
> > This patch adds a warning message in the ath3k driver when
> > ath3k_switch_pid() returns error.
> >
> > This event happens in a specific laptop, with an adapter which
> > identifies itself as 0cf3:0036. Surprisingly, the adapter works even
> > after this event - hence a warning is chosen instead of an error.
> >
> > The current version of ath3k doesn't check the return value of
> > ath3k_switch_pid() and so this event may remain undetected in the
> > original version.
>
> if works anyway, why bother with a warning? I have no idea what benefit this has.
>

I analyze this issue as having three possible cases:

(1) the function works, and so, no problems, no warnings;

(2) (my case) the function fails but the system works as it should do;
in this case I would agree with you, but

(3) the function fails and this affects the whole system (let's say, the
VID:PID doesn't change as intended); in this case there's a problem and
the admin should be in a better position if one can be watched by this
warning.

Based on the code, there's no way to diferentiate (2) and (3), so IMHO a
warning would be justified.


Best regards,

Luiz