[PATCH] Bluetooth: btmtk: use bool for first_block
Miles Krause via B4 Relay
devnull+mileskrause5200.gmail.com at kernel.org
Thu Jul 9 22:17:18 PDT 2026
From: Miles Krause <mileskrause5200 at gmail.com>
first_block is reset for each firmware section and is never used outside
the section loop. Declare it as a bool inside the loop to limit its scope
and make its two-state purpose explicit.
No functional change.
Signed-off-by: Miles Krause <mileskrause5200 at gmail.com>
---
Compile-tested on x86_64 with:
make O=out allmodconfig
make O=out W=1 drivers/bluetooth/btmtk.o
Sparse-tested with:
make O=out-sparse allmodconfig
make O=out-sparse C=1 CHECK=sparse drivers/bluetooth/btmtk.o
---
drivers/bluetooth/btmtk.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index 809762d64fc6..b809eb82fc73 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -63,7 +63,7 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
const u8 *fw_ptr;
const u8 *fw_bin_ptr;
int err, dlen, i, status;
- u8 flag, first_block, retry;
+ u8 flag, retry;
u32 section_num, dl_size, section_offset;
u8 cmd[64];
@@ -79,7 +79,7 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
section_num = le32_to_cpu(globaldesc->section_num);
for (i = 0; i < section_num; i++) {
- first_block = 1;
+ bool first_block = true;
fw_ptr = fw_bin_ptr;
sectionmap = (struct btmtk_section_map *)(fw_ptr + MTK_FW_ROM_PATCH_HEADER_SIZE +
MTK_FW_ROM_PATCH_GD_SIZE + MTK_FW_ROM_PATCH_SEC_MAP_SIZE * i);
@@ -132,9 +132,9 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
while (dl_size > 0) {
dlen = min_t(int, 250, dl_size);
- if (first_block == 1) {
+ if (first_block) {
flag = 1;
- first_block = 0;
+ first_block = false;
} else if (dl_size - dlen <= 0) {
flag = 3;
} else {
---
base-commit: 64b5c4c8e79c131fe8f135bab5e5dfaa245c5776
change-id: 20260710-btmtk-first-block-bool-bd047b970821
Best regards,
--
Miles Krause <mileskrause5200 at gmail.com>
More information about the Linux-mediatek
mailing list