All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: mgmt: remove redundant assignment to variable cur_len
@ 2022-03-07 15:53 Colin Ian King
  2022-03-07 16:50 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2022-03-07 15:53 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	David S . Miller, Jakub Kicinski, linux-bluetooth, netdev
  Cc: kernel-janitors, linux-kernel, llvm

Variable cur_len is being ininitialized with a value in the start of
a for-loop but this is never read, it is being re-assigned a new value
on the first statement in the for-loop.  The initialization is redundant
and can be removed.

Cleans up clang scan build warning:
net/bluetooth/mgmt.c:7958:14: warning: Although the value stored to 'cur_len'
is used in the enclosing expression, the value is never actually read
from 'cur_len' [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 net/bluetooth/mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 8101a6a31841..e0137bc1080e 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -7955,7 +7955,7 @@ static bool tlv_data_is_valid(struct hci_dev *hdev, u32 adv_flags, u8 *data,
 		return false;
 
 	/* Make sure that the data is correctly formatted. */
-	for (i = 0, cur_len = 0; i < len; i += (cur_len + 1)) {
+	for (i = 0; i < len; i += (cur_len + 1)) {
 		cur_len = data[i];
 
 		if (!cur_len)
-- 
2.35.1


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

* Re: [PATCH] Bluetooth: mgmt: remove redundant assignment to variable cur_len
  2022-03-07 15:53 [PATCH] Bluetooth: mgmt: remove redundant assignment to variable cur_len Colin Ian King
@ 2022-03-07 16:50 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2022-03-07 16:50 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Johan Hedberg, Luiz Augusto von Dentz, David S. Miller,
	Jakub Kicinski, BlueZ, open list:NETWORKING [GENERAL],
	kernel-janitors, LKML, llvm

Hi Colin,

> Variable cur_len is being ininitialized with a value in the start of
> a for-loop but this is never read, it is being re-assigned a new value
> on the first statement in the for-loop.  The initialization is redundant
> and can be removed.
> 
> Cleans up clang scan build warning:
> net/bluetooth/mgmt.c:7958:14: warning: Although the value stored to 'cur_len'
> is used in the enclosing expression, the value is never actually read
> from 'cur_len' [deadcode.DeadStores]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> net/bluetooth/mgmt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

end of thread, other threads:[~2022-03-07 16:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07 15:53 [PATCH] Bluetooth: mgmt: remove redundant assignment to variable cur_len Colin Ian King
2022-03-07 16:50 ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.