LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH -next] Bluetooth: btusb: Fix the application of sizeof to pointer
@ 2021-09-03  7:16 Yang Li
  2021-09-10  7:33 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2021-09-03  7:16 UTC (permalink / raw)
  To: marcel; +Cc: johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel, Yang Li

sizeof() when applied to a pointer typed expression gives the size of
the pointer.

Clean up coccicheck warning:
./drivers/bluetooth/btusb.c:2210:36-42: ERROR: application of sizeof to
pointer

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/bluetooth/btusb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 928cbfa..5bf479e 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2207,7 +2207,7 @@ static int btusb_set_bdaddr_mtk(struct hci_dev *hdev, const bdaddr_t *bdaddr)
 	struct sk_buff *skb;
 	long ret;
 
-	skb = __hci_cmd_sync(hdev, 0xfc1a, sizeof(bdaddr), bdaddr, HCI_INIT_TIMEOUT);
+	skb = __hci_cmd_sync(hdev, 0xfc1a, sizeof(*bdaddr), bdaddr, HCI_INIT_TIMEOUT);
 	if (IS_ERR(skb)) {
 		ret = PTR_ERR(skb);
 		bt_dev_err(hdev, "changing Mediatek device address failed (%ld)",
-- 
1.8.3.1


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

* Re: [PATCH -next] Bluetooth: btusb: Fix the application of sizeof to pointer
  2021-09-03  7:16 [PATCH -next] Bluetooth: btusb: Fix the application of sizeof to pointer Yang Li
@ 2021-09-10  7:33 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2021-09-10  7:33 UTC (permalink / raw)
  To: Yang Li
  Cc: Johan Hedberg, Luiz Augusto von Dentz, linux-bluetooth, linux-kernel

Hi Yang,

> sizeof() when applied to a pointer typed expression gives the size of
> the pointer.
> 
> Clean up coccicheck warning:
> ./drivers/bluetooth/btusb.c:2210:36-42: ERROR: application of sizeof to
> pointer
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
> drivers/bluetooth/btusb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 928cbfa..5bf479e 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -2207,7 +2207,7 @@ static int btusb_set_bdaddr_mtk(struct hci_dev *hdev, const bdaddr_t *bdaddr)
> 	struct sk_buff *skb;
> 	long ret;
> 
> -	skb = __hci_cmd_sync(hdev, 0xfc1a, sizeof(bdaddr), bdaddr, HCI_INIT_TIMEOUT);
> +	skb = __hci_cmd_sync(hdev, 0xfc1a, sizeof(*bdaddr), bdaddr, HCI_INIT_TIMEOUT);

lets just do 0xfc1a, 6, bdaddr like the other functions do as well.

Regards

Marcel


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

end of thread, other threads:[~2021-09-10  7:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03  7:16 [PATCH -next] Bluetooth: btusb: Fix the application of sizeof to pointer Yang Li
2021-09-10  7:33 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).