Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btmtk: use bool for first_block
@ 2026-07-10  5:17 Miles Krause via B4 Relay
  0 siblings, 0 replies; 2+ messages in thread
From: Miles Krause via B4 Relay @ 2026-07-10  5:17 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Matthias Brugger
  Cc: linux-bluetooth, linux-arm-kernel, linux-mediatek, linux-kernel,
	Miles Krause

From: Miles Krause <mileskrause5200@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@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@gmail.com>




^ permalink raw reply related	[flat|nested] 2+ messages in thread
[parent not found: <20260710-btmtk-first-block-bool-v1-1-3602688ec523@gmail.com>]

end of thread, other threads:[~2026-07-11  2:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10  5:17 [PATCH] Bluetooth: btmtk: use bool for first_block Miles Krause via B4 Relay
     [not found] <20260710-btmtk-first-block-bool-v1-1-3602688ec523@gmail.com>
2026-07-11  2:41 ` Miles Krause

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox