mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] Bluetooth: Trivial cleanup
@ 2025-06-23 12:31 Zijun Hu
  2025-06-23 12:31 ` [PATCH 1/4] Bluetooth: hci_sock: Reset cookie to zero in hci_sock_free_cookie() Zijun Hu
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Zijun Hu @ 2025-06-23 12:31 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
  Cc: Zijun Hu, linux-bluetooth, linux-kernel, Zijun Hu

This patch series is to do trivial cleanup for bluetooth core driver.

Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
Zijun Hu (4):
      Bluetooth: hci_sock: Reset cookie to zero in hci_sock_free_cookie()
      Bluetooth: hci_sync: Use bt_dev_err() to log error message in hci_update_event_filter_sync()
      Bluetooth: hci_core: Eliminate an unnecessary goto label in hci_find_irk_by_addr()
      Bluetooth: hci_event: Correct comment about HCI_EV_EXTENDED_INQUIRY_RESULT

 net/bluetooth/hci_core.c  | 4 +---
 net/bluetooth/hci_event.c | 2 +-
 net/bluetooth/hci_sock.c  | 2 +-
 net/bluetooth/hci_sync.c  | 2 +-
 4 files changed, 4 insertions(+), 6 deletions(-)
---
base-commit: dc3f099e8d709c2fbb25e1079e1b3d703a6828b2
change-id: 20250623-bt_cleanup-faf5bcac3ba9

Best regards,
-- 
Zijun Hu <zijun.hu@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] Bluetooth: hci_sock: Reset cookie to zero in hci_sock_free_cookie()
  2025-06-23 12:31 [PATCH 0/4] Bluetooth: Trivial cleanup Zijun Hu
@ 2025-06-23 12:31 ` Zijun Hu
  2025-06-23 12:31 ` [PATCH 2/4] Bluetooth: hci_sync: Use bt_dev_err() to log error message in hci_update_event_filter_sync() Zijun Hu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Zijun Hu @ 2025-06-23 12:31 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
  Cc: Zijun Hu, linux-bluetooth, linux-kernel, Zijun Hu

From: Zijun Hu <zijun.hu@oss.qualcomm.com>

Reset cookie value to 0 instead of 0xffffffff in hci_sock_free_cookie()
since:
0         :  means cookie has not been assigned yet
0xffffffff:  means cookie assignment failure

Also fix generating cookie failure with usage shown below:
hci_sock_gen_cookie(sk)   // generate cookie
hci_sock_free_cookie(sk)  // free cookie
hci_sock_gen_cookie(sk)   // Can't generate cookie any more

Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
 net/bluetooth/hci_sock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 428ee5c7de7ea32fea08a2ebcf57e30dee59e3fa..fc866759910d95f40f159cfd63710f4c5e519dfd 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -118,7 +118,7 @@ static void hci_sock_free_cookie(struct sock *sk)
 	int id = hci_pi(sk)->cookie;
 
 	if (id) {
-		hci_pi(sk)->cookie = 0xffffffff;
+		hci_pi(sk)->cookie = 0;
 		ida_free(&sock_cookie_ida, id);
 	}
 }

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/4] Bluetooth: hci_sync: Use bt_dev_err() to log error message in hci_update_event_filter_sync()
  2025-06-23 12:31 [PATCH 0/4] Bluetooth: Trivial cleanup Zijun Hu
  2025-06-23 12:31 ` [PATCH 1/4] Bluetooth: hci_sock: Reset cookie to zero in hci_sock_free_cookie() Zijun Hu
@ 2025-06-23 12:31 ` Zijun Hu
  2025-06-23 12:31 ` [PATCH 3/4] Bluetooth: hci_core: Eliminate an unnecessary goto label in hci_find_irk_by_addr() Zijun Hu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Zijun Hu @ 2025-06-23 12:31 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
  Cc: Zijun Hu, linux-bluetooth, linux-kernel, Zijun Hu

From: Zijun Hu <zijun.hu@oss.qualcomm.com>

Use bt_dev_err() instead of bt_dev_dbg() to log error message in
hci_update_event_filter_sync().

Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
 net/bluetooth/hci_sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 6687f2a4d1eb44c154f471ed0c4cad7e8d437c88..9288a2ff5476fba04729799e7b7d8b4d43087e6c 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -6073,7 +6073,7 @@ static int hci_update_event_filter_sync(struct hci_dev *hdev)
 						 &b->bdaddr,
 						 HCI_CONN_SETUP_AUTO_ON);
 		if (err)
-			bt_dev_dbg(hdev, "Failed to set event filter for %pMR",
+			bt_dev_err(hdev, "Failed to set event filter for %pMR",
 				   &b->bdaddr);
 		else
 			scan = SCAN_PAGE;

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/4] Bluetooth: hci_core: Eliminate an unnecessary goto label in hci_find_irk_by_addr()
  2025-06-23 12:31 [PATCH 0/4] Bluetooth: Trivial cleanup Zijun Hu
  2025-06-23 12:31 ` [PATCH 1/4] Bluetooth: hci_sock: Reset cookie to zero in hci_sock_free_cookie() Zijun Hu
  2025-06-23 12:31 ` [PATCH 2/4] Bluetooth: hci_sync: Use bt_dev_err() to log error message in hci_update_event_filter_sync() Zijun Hu
@ 2025-06-23 12:31 ` Zijun Hu
  2025-06-23 12:31 ` [PATCH 4/4] Bluetooth: hci_event: Correct comment about HCI_EV_EXTENDED_INQUIRY_RESULT Zijun Hu
  2025-06-23 19:10 ` [PATCH 0/4] Bluetooth: Trivial cleanup patchwork-bot+bluetooth
  4 siblings, 0 replies; 6+ messages in thread
From: Zijun Hu @ 2025-06-23 12:31 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
  Cc: Zijun Hu, linux-bluetooth, linux-kernel, Zijun Hu

From: Zijun Hu <zijun.hu@oss.qualcomm.com>

Eliminate an unnecessary goto label by using break instead of goto to
exit the loop in hci_find_irk_by_addr().

Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
 net/bluetooth/hci_core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index ce1d8c997a31529996ad98f22ec0997ed3ac9b36..9af4d7345e4df1d715fdab7427a700007303f65e 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1256,12 +1256,10 @@ struct smp_irk *hci_find_irk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
 		if (addr_type == irk->addr_type &&
 		    bacmp(bdaddr, &irk->bdaddr) == 0) {
 			irk_to_return = irk;
-			goto done;
+			break;
 		}
 	}
 
-done:
-
 	if (irk_to_return && hci_is_blocked_key(hdev, HCI_BLOCKED_KEY_TYPE_IRK,
 						irk_to_return->val)) {
 		bt_dev_warn_ratelimited(hdev, "Identity key blocked for %pMR",

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/4] Bluetooth: hci_event: Correct comment about HCI_EV_EXTENDED_INQUIRY_RESULT
  2025-06-23 12:31 [PATCH 0/4] Bluetooth: Trivial cleanup Zijun Hu
                   ` (2 preceding siblings ...)
  2025-06-23 12:31 ` [PATCH 3/4] Bluetooth: hci_core: Eliminate an unnecessary goto label in hci_find_irk_by_addr() Zijun Hu
@ 2025-06-23 12:31 ` Zijun Hu
  2025-06-23 19:10 ` [PATCH 0/4] Bluetooth: Trivial cleanup patchwork-bot+bluetooth
  4 siblings, 0 replies; 6+ messages in thread
From: Zijun Hu @ 2025-06-23 12:31 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
  Cc: Zijun Hu, linux-bluetooth, linux-kernel, Zijun Hu

From: Zijun Hu <zijun.hu@oss.qualcomm.com>

HCI_EV_EXTENDED_INQUIRY_RESULT's comment wrongly uses 0x2d as its event
code.

Use right 0x2f instead.

Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
---
 net/bluetooth/hci_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 66052d6aaa1d503cfcd542656d0ffbc5824e239f..c4b87bfb4c1a76cd865290ba2bbce7901a6c26ef 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -7433,7 +7433,7 @@ static const struct hci_ev {
 	/* [0x2c = HCI_EV_SYNC_CONN_COMPLETE] */
 	HCI_EV(HCI_EV_SYNC_CONN_COMPLETE, hci_sync_conn_complete_evt,
 	       sizeof(struct hci_ev_sync_conn_complete)),
-	/* [0x2d = HCI_EV_EXTENDED_INQUIRY_RESULT] */
+	/* [0x2f = HCI_EV_EXTENDED_INQUIRY_RESULT] */
 	HCI_EV_VL(HCI_EV_EXTENDED_INQUIRY_RESULT,
 		  hci_extended_inquiry_result_evt,
 		  sizeof(struct hci_ev_ext_inquiry_result), HCI_MAX_EVENT_SIZE),

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] Bluetooth: Trivial cleanup
  2025-06-23 12:31 [PATCH 0/4] Bluetooth: Trivial cleanup Zijun Hu
                   ` (3 preceding siblings ...)
  2025-06-23 12:31 ` [PATCH 4/4] Bluetooth: hci_event: Correct comment about HCI_EV_EXTENDED_INQUIRY_RESULT Zijun Hu
@ 2025-06-23 19:10 ` patchwork-bot+bluetooth
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+bluetooth @ 2025-06-23 19:10 UTC (permalink / raw)
  To: Zijun Hu
  Cc: marcel, johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel,
	zijun.hu

Hello:

This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon, 23 Jun 2025 20:31:15 +0800 you wrote:
> This patch series is to do trivial cleanup for bluetooth core driver.
> 
> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
> ---
> Zijun Hu (4):
>       Bluetooth: hci_sock: Reset cookie to zero in hci_sock_free_cookie()
>       Bluetooth: hci_sync: Use bt_dev_err() to log error message in hci_update_event_filter_sync()
>       Bluetooth: hci_core: Eliminate an unnecessary goto label in hci_find_irk_by_addr()
>       Bluetooth: hci_event: Correct comment about HCI_EV_EXTENDED_INQUIRY_RESULT
> 
> [...]

Here is the summary with links:
  - [1/4] Bluetooth: hci_sock: Reset cookie to zero in hci_sock_free_cookie()
    https://git.kernel.org/bluetooth/bluetooth-next/c/6d7d36f62bfd
  - [2/4] Bluetooth: hci_sync: Use bt_dev_err() to log error message in hci_update_event_filter_sync()
    https://git.kernel.org/bluetooth/bluetooth-next/c/482e06a993a7
  - [3/4] Bluetooth: hci_core: Eliminate an unnecessary goto label in hci_find_irk_by_addr()
    https://git.kernel.org/bluetooth/bluetooth-next/c/88855693e5a0
  - [4/4] Bluetooth: hci_event: Correct comment about HCI_EV_EXTENDED_INQUIRY_RESULT
    https://git.kernel.org/bluetooth/bluetooth-next/c/b02c1d6f2df3

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-06-23 19:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-23 12:31 [PATCH 0/4] Bluetooth: Trivial cleanup Zijun Hu
2025-06-23 12:31 ` [PATCH 1/4] Bluetooth: hci_sock: Reset cookie to zero in hci_sock_free_cookie() Zijun Hu
2025-06-23 12:31 ` [PATCH 2/4] Bluetooth: hci_sync: Use bt_dev_err() to log error message in hci_update_event_filter_sync() Zijun Hu
2025-06-23 12:31 ` [PATCH 3/4] Bluetooth: hci_core: Eliminate an unnecessary goto label in hci_find_irk_by_addr() Zijun Hu
2025-06-23 12:31 ` [PATCH 4/4] Bluetooth: hci_event: Correct comment about HCI_EV_EXTENDED_INQUIRY_RESULT Zijun Hu
2025-06-23 19:10 ` [PATCH 0/4] Bluetooth: Trivial cleanup patchwork-bot+bluetooth

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

all inboxes | Powered by JetHome®