Skip to contentSkip to conversation

NFC: nci: Remove redundant assignment to len

PATCH Applied Yang Li 3 participants 3 messages Jun 1, 2021

Subsystems (3)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 NFC: nci: Remove redundant assignment to len

Variable 'len' is set to conn_info->max_pkt_payload_len but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed.

Clean up the following clang-analyzer warning:

net/nfc/nci/hci.c:164:3: warning: Value stored to 'len' is never read [clang-analyzer-deadcode.DeadStores]

---
 net/nfc/nci/hci.c | 2 --
 1 file changed, 2 deletions(-)
net/nfc/nci/hci.c +0 -2
index 9686514..d6732e5 100644
@@ -161,8 +161,6 @@ static int nci_hci_send_data(struct nci_dev *ndev, u8 pipe,
 	*(u8 *)skb_push(skb, 1) = data_type;
 
 	do {
-		len = conn_info->max_pkt_payload_len;
-
 		/* If last packet add NCI_HFP_NO_CHAINING */
 		if (i + conn_info->max_pkt_payload_len -
 		    (skb->len + 1) >= data_len) {
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · Yang Li

Variable 'len' is set to conn_info->max_pkt_payload_len but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed.

Clean up the following clang-analyzer warning:

net/nfc/nci/hci.c:164:3: warning: Value stored to 'len' is never read [clang-analyzer-deadcode.DeadStores]

---
 net/nfc/nci/hci.c | 2 --
 1 file changed, 2 deletions(-)
net/nfc/nci/hci.c +0 -0
index 9686514..d6732e5 100644

net/nfc/nci/hci.c static int nci_hci_send_data(struct nci_dev *ndev, u8 pipe, · line 166

Quoted 8 lines
net/nfc/nci/hci.c +0 -2
@@ -161,8 +161,6 @@ static int nci_hci_send_data(struct nci_dev *ndev, u8 pipe,
 	*(u8 *)skb_push(skb, 1) = data_type;
 
 	do {
-		len = conn_info->max_pkt_payload_len;
-
 		/* If last packet add NCI_HFP_NO_CHAINING */
 		if (i + conn_info->max_pkt_payload_len -
 		    (skb->len + 1) >= data_len) {

Best regards,
Krzysztof

#2 lore raw
In reply to Yang Li
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 10 lines · On Tue, 1 Jun 2021 17:49:50 +0800 you wrote:

Variable 'len' is set to conn_info->max_pkt_payload_len but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed.

Clean up the following clang-analyzer warning:

net/nfc/nci/hci.c:164:3: warning: Value stored to 'len' is never read [clang-analyzer-deadcode.DeadStores]

[...]

Here is the summary with links:
- NFC: nci: Remove redundant assignment to len

    https://git.kernel.org/netdev/net-next/c/7cf85f8caa04

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