Skip to contentSkip to conversation

ath3k: add more information to error message

PATCH In review Luiz Carlos Ramos 2 participants 3 messages Sep 7, 2018 – Sep 27, 2018 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath3k: add more information to error message

When there is an error in either ath3k_load_firmware() or ath3k_load_fwfile(), the inlined function ath3k_log_failed_loading() is called receiving the error returned and both the block size requested to load and the size actually loaded. These values are printed in an error message using the macro BT_ERR.

This patch creates a new function which does the same but also receives the "count" variable, in order to show more information when a failing firmware loading happens. The calls to the older function were changed to the new one.

This event is being monitored in a laptop with an adapter which identifies itself as 0cf3:0036, where sometimes there are errors in the firmware loading process.

---
 drivers/bluetooth/ath3k.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/bluetooth/ath3k.c +10 -2
index 3a8c47efea55..ebc312cb4412 100644
@@ -209,6 +209,14 @@ static inline void ath3k_log_failed_loading(int err, int len, int size)
 			err, len, size);
 }
 
+static inline void ath3k_log_failed_loading_2(int err, int len, int size,
+						int count)
+{
+	BT_ERR("%s err = %d, len = %d, size = %d, count = %d",
+			"Error in firmware loading",
+			err, len, size, count);
+}
+
 #define USB_REQ_DFU_DNLOAD	1
 #define BULK_SIZE		4096
 #define FW_HDR_SIZE		20
@@ -257,7 +265,7 @@ static int ath3k_load_firmware(struct usb_device *udev,
 					&len, 3000);
 
 		if (err || (len != size)) {
-			ath3k_log_failed_loading(err, len, size);
+			ath3k_log_failed_loading_2(err, len, size, count);
 			goto error;
 		}
 
@@ -356,7 +364,7 @@ static int ath3k_load_fwfile(struct usb_device *udev,
 		err = usb_bulk_msg(udev, pipe, send_buf, size,
 					&len, 3000);
 		if (err || (len != size)) {
-			ath3k_log_failed_loading(err, len, size);
+			ath3k_log_failed_loading_2(err, len, size, count);
 			kfree(send_buf);
 			return err;
 		}
Signature · 1 line
2.14.4
maintainer
#1 lore raw

Hi Luiz,

Quoted 26 lines

When there is an error in either ath3k_load_firmware() or ath3k_load_fwfile(), the inlined function ath3k_log_failed_loading() is called receiving the error returned and both the block size requested to load and the size actually loaded. These values are printed in an error message using the macro BT_ERR.

This patch creates a new function which does the same but also receives the "count" variable, in order to show more information when a failing firmware loading happens. The calls to the older function were changed to the new one.

This event is being monitored in a laptop with an adapter which identifies itself as 0cf3:0036, where sometimes there are errors in the firmware loading process.

---
drivers/bluetooth/ath3k.c | 12 ++++++++++--

1 file changed, 10 insertions(+), 2 deletions(-)
drivers/bluetooth/ath3k.c +0 -0
index 3a8c47efea55..ebc312cb4412 100644
@@ -209,6 +209,14 @@ static inline void ath3k_log_failed_loading(int err, int len, int size)
 			err, len, size);

drivers/bluetooth/ath3k.c static inline void ath3k_log_failed_loading(int err, int len, int size) · line 219

Quoted 10 lines
drivers/bluetooth/ath3k.c +8 -0
 }
 
+static inline void ath3k_log_failed_loading_2(int err, int len, int size,
+						int count)
+{
+	BT_ERR("%s err = %d, len = %d, size = %d, count = %d",
+			"Error in firmware loading",
+			err, len, size, count);
+}
+

just change the the original ath3k_log_failed_loading to include the count parameter.

Regards

Marcel

#2 lore raw

Hi, Marcel,

Quoted 30 lines · Marcel Holtmann

Hi Luiz,

Quoted 28 lines

When there is an error in either ath3k_load_firmware() or ath3k_load_fwfile(), the inlined function ath3k_log_failed_loading() is called receiving the error returned and both the block size requested to load and the size actually loaded. These values are printed in an error message using the macro BT_ERR.

This patch creates a new function which does the same but also receives the "count" variable, in order to show more information when a failing firmware loading happens. The calls to the older function were changed to the new one.

This event is being monitored in a laptop with an adapter which identifies itself as 0cf3:0036, where sometimes there are errors in the firmware loading process.

---
drivers/bluetooth/ath3k.c | 12 ++++++++++--

1 file changed, 10 insertions(+), 2 deletions(-)
drivers/bluetooth/ath3k.c +0 -0
index 3a8c47efea55..ebc312cb4412 100644
@@ -209,6 +209,14 @@ static inline void ath3k_log_failed_loading(int err, int len, int size)
 			err, len, size);
 }
 
Quoted 11 lines

drivers/bluetooth/ath3k.c static inline void ath3k_log_failed_loading(int err, int len, int size) · line 219

Quoted 8 lines
drivers/bluetooth/ath3k.c +8 -0
+static inline void ath3k_log_failed_loading_2(int err, int len, int size,
+						int count)
+{
+	BT_ERR("%s err = %d, len = %d, size = %d, count = %d",
+			"Error in firmware loading",
+			err, len, size, count);
+}
+

just change the the original ath3k_log_failed_loading to include the count parameter.

Ok, fine. I'll send it in a next message.

Many thanks,

Luiz