diff mbox series

Bluetooth: bfusb: Updated code to follow style guide

Message ID 20240308162037.100226-1-ayaanmirza.788@gmail.com (mailing list archive)
State New, archived
Headers show
Series Bluetooth: bfusb: Updated code to follow style guide | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch warning WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?) #93: Added indendations, removed trailing spaces, added empty lines after declaration. total: 0 errors, 1 warnings, 31 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13587034.patch has style problems, please review. NOTE: Ignored message types: UNKNOWN_COMMIT_ID NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
tedd_an/GitLint fail WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search 3: B1 Line exceeds max length (81>80): "Added indendations, removed trailing spaces, added empty lines after declaration."
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse success CheckSparse PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester success TestRunner PASS
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Ayaan Mirza Baig March 8, 2024, 4:20 p.m. UTC
Added indendations, removed trailing spaces, added empty lines after declaration.
Fixed Warnings with checkpatch

Signed-off-by: Ayaan Mirza Baig <ayaanmirza.788@gmail.com>
---
 drivers/bluetooth/bfusb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com March 8, 2024, 4:43 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=833841

---Test result---

Test Summary:
CheckPatch                    FAIL      0.89 seconds
GitLint                       FAIL      0.48 seconds
SubjectPrefix                 PASS      0.11 seconds
BuildKernel                   PASS      27.03 seconds
CheckAllWarning               PASS      29.71 seconds
CheckSparse                   PASS      34.77 seconds
CheckSmatch                   PASS      96.15 seconds
BuildKernel32                 PASS      26.14 seconds
TestRunnerSetup               PASS      492.94 seconds
TestRunner_l2cap-tester       PASS      17.63 seconds
TestRunner_iso-tester         PASS      29.65 seconds
TestRunner_bnep-tester        PASS      4.62 seconds
TestRunner_mgmt-tester        PASS      105.66 seconds
TestRunner_rfcomm-tester      PASS      7.06 seconds
TestRunner_sco-tester         PASS      14.70 seconds
TestRunner_ioctl-tester       PASS      7.52 seconds
TestRunner_mesh-tester        PASS      5.61 seconds
TestRunner_smp-tester         PASS      7.15 seconds
TestRunner_userchan-tester    PASS      4.76 seconds
IncrementalBuild              PASS      25.17 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: bfusb: Updated code to follow style guide
WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
#93: 
Added indendations, removed trailing spaces, added empty lines after declaration.

total: 0 errors, 1 warnings, 31 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13587034.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
Bluetooth: bfusb: Updated code to follow style guide

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
3: B1 Line exceeds max length (81>80): "Added indendations, removed trailing spaces, added empty lines after declaration."


---
Regards,
Linux Bluetooth
Joe Perches March 8, 2024, 6:08 p.m. UTC | #2
On Fri, 2024-03-08 at 21:50 +0530, Ayaan Mirza Baig wrote:
> Added indendations, removed trailing spaces, added empty lines after declaration.

indendations/indentations.

Do please try to not just mollify checkpatch message bleats
but try to make the code more intelligible.

I think the tests are backwards would better be written
with fewer block indentations and direct returns without
creating used-once temporaries like:

---
 drivers/bluetooth/bfusb.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index cab93935cc7f1..68587424187e6 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -273,33 +273,27 @@ static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
 
 		switch (pkt_type) {
 		case HCI_EVENT_PKT:
-			if (len >= HCI_EVENT_HDR_SIZE) {
-				struct hci_event_hdr *hdr = (struct hci_event_hdr *) buf;
-				pkt_len = HCI_EVENT_HDR_SIZE + hdr->plen;
-			} else {
+			if (len < HCI_EVENT_HDR_SIZE) {
 				bt_dev_err(data->hdev, "event block is too short");
 				return -EILSEQ;
 			}
+			pkt_len = HCI_EVENT_HDR_SIZE + ((struct hci_event_hdr *)buf)->plen;
 			break;
 
 		case HCI_ACLDATA_PKT:
-			if (len >= HCI_ACL_HDR_SIZE) {
-				struct hci_acl_hdr *hdr = (struct hci_acl_hdr *) buf;
-				pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(hdr->dlen);
-			} else {
+			if (len < HCI_ACL_HDR_SIZE) {
 				bt_dev_err(data->hdev, "data block is too short");
 				return -EILSEQ;
 			}
+			pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(((struct hci_acl_hdr *)buf)->dlen);
 			break;
 
 		case HCI_SCODATA_PKT:
-			if (len >= HCI_SCO_HDR_SIZE) {
-				struct hci_sco_hdr *hdr = (struct hci_sco_hdr *) buf;
-				pkt_len = HCI_SCO_HDR_SIZE + hdr->dlen;
-			} else {
+			if (len < HCI_SCO_HDR_SIZE) {
 				bt_dev_err(data->hdev, "audio block is too short");
 				return -EILSEQ;
 			}
+			pkt_len = HCI_SCO_HDR_SIZE + ((struct hci_sco_hdr *)buf)->dlen;
 			break;
 		}
 
@@ -365,9 +359,8 @@ static void bfusb_rx_complete(struct urb *urb)
 			buf   += 3;
 		}
 
-		if (count < len) {
+		if (count < len)
 			bt_dev_err(data->hdev, "block extends over URB buffer ranges");
-		}
 
 		if ((hdr & 0xe1) == 0xc1)
 			bfusb_recv_block(data, hdr, buf, len);
diff mbox series

Patch

diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index cab93935cc7f..08beae26e345 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -275,6 +275,7 @@  static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
 		case HCI_EVENT_PKT:
 			if (len >= HCI_EVENT_HDR_SIZE) {
 				struct hci_event_hdr *hdr = (struct hci_event_hdr *) buf;
+
 				pkt_len = HCI_EVENT_HDR_SIZE + hdr->plen;
 			} else {
 				bt_dev_err(data->hdev, "event block is too short");
@@ -285,6 +286,7 @@  static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
 		case HCI_ACLDATA_PKT:
 			if (len >= HCI_ACL_HDR_SIZE) {
 				struct hci_acl_hdr *hdr = (struct hci_acl_hdr *) buf;
+
 				pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(hdr->dlen);
 			} else {
 				bt_dev_err(data->hdev, "data block is too short");
@@ -295,6 +297,7 @@  static inline int bfusb_recv_block(struct bfusb_data *data, int hdr, unsigned ch
 		case HCI_SCODATA_PKT:
 			if (len >= HCI_SCO_HDR_SIZE) {
 				struct hci_sco_hdr *hdr = (struct hci_sco_hdr *) buf;
+
 				pkt_len = HCI_SCO_HDR_SIZE + hdr->dlen;
 			} else {
 				bt_dev_err(data->hdev, "audio block is too short");
@@ -365,9 +368,8 @@  static void bfusb_rx_complete(struct urb *urb)
 			buf   += 3;
 		}
 
-		if (count < len) {
+		if (count < len)
 			bt_dev_err(data->hdev, "block extends over URB buffer ranges");
-		}
 
 		if ((hdr & 0xe1) == 0xc1)
 			bfusb_recv_block(data, hdr, buf, len);