diff mbox series

Bluetooth: btusb: Fix a unspported condition to set available debug features

Message ID 20210709134625.1235015-1-jun.miao@windriver.com
State Superseded
Headers show
Series Bluetooth: btusb: Fix a unspported condition to set available debug features | expand

Commit Message

Jun Miao July 9, 2021, 1:46 p.m. UTC
When reading the support debug features failed, there are not available
features init. Continue to set the debug features is illogical, we should
skip btintel_set_debug_features(), even if check it by "if (!features)".

Fixes: c453b10c2b28 ("Bluetooth: btusb: Configure Intel debug feature based on
available support")
Signed-off-by: Jun Miao <jun.miao@windriver.com>
---
 drivers/bluetooth/btusb.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Comments

Marcel Holtmann July 22, 2021, 2:17 p.m. UTC | #1
Hi Jun,

> When reading the support debug features failed, there are not available

> features init. Continue to set the debug features is illogical, we should

> skip btintel_set_debug_features(), even if check it by "if (!features)".

> 

> Fixes: c453b10c2b28 ("Bluetooth: btusb: Configure Intel debug feature based on

> available support")

> Signed-off-by: Jun Miao <jun.miao@windriver.com>

> ---

> drivers/bluetooth/btusb.c | 18 ++++++++++--------

> 1 file changed, 10 insertions(+), 8 deletions(-)


patch has been applied to bluetooth-next tree.

Regards

Marcel
diff mbox series

Patch

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 7f6ba2c975ed..a3c027d17745 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2889,10 +2889,11 @@  static int btusb_setup_intel_new(struct hci_dev *hdev)
 	/* Read the Intel supported features and if new exception formats
 	 * supported, need to load the additional DDC config to enable.
 	 */
-	btintel_read_debug_features(hdev, &features);
-
-	/* Set DDC mask for available debug features */
-	btintel_set_debug_features(hdev, &features);
+	err = btintel_read_debug_features(hdev, &features);
+	if (!err) {
+		/* Set DDC mask for available debug features */
+		btintel_set_debug_features(hdev, &features);
+	}
 
 	/* Read the Intel version information after loading the FW  */
 	err = btintel_read_version(hdev, &ver);
@@ -2985,10 +2986,11 @@  static int btusb_setup_intel_newgen(struct hci_dev *hdev)
 	/* Read the Intel supported features and if new exception formats
 	 * supported, need to load the additional DDC config to enable.
 	 */
-	btintel_read_debug_features(hdev, &features);
-
-	/* Set DDC mask for available debug features */
-	btintel_set_debug_features(hdev, &features);
+	err = btintel_read_debug_features(hdev, &features);
+	if (!err) {
+		/* Set DDC mask for available debug features */
+		btintel_set_debug_features(hdev, &features);
+	}
 
 	/* Read the Intel version information after loading the FW  */
 	err = btintel_read_version_tlv(hdev, &version);