Skip to contentSkip to conversation

net/ieee802154: drop unneeded assignment in llsec_iter_devkeys()

PATCH In review Yang Li 2 participants 2 messages Apr 25, 2021 – Jun 3, 2021

Subsystems (3)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 net/ieee802154: drop unneeded assignment in llsec_iter_devkeys()

In order to keep the code style consistency of the whole file, redundant return value ‘rc’ and its assignments should be deleted

The clang_analyzer complains as follows:
net/ieee802154/nl-mac.c:1203:12: warning: Although the value stored to 'rc' is used in the enclosing expression, the value is never actually read from 'rc'

No functional change, only more efficient.

---
 net/ieee802154/nl-mac.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/ieee802154/nl-mac.c +3 -3
index 0c1b077..a6a8cf6 100644
@@ -1184,7 +1184,7 @@ static int llsec_iter_devkeys(struct llsec_dump_data *data)
 {
 	struct ieee802154_llsec_device *dpos;
 	struct ieee802154_llsec_device_key *kpos;
-	int rc = 0, idx = 0, idx2;
+	int idx = 0, idx2;
 
 	list_for_each_entry(dpos, &data->table->devices, list) {
 		if (idx++ < data->s_idx)
@@ -1200,7 +1200,7 @@ static int llsec_iter_devkeys(struct llsec_dump_data *data)
 						      data->nlmsg_seq,
 						      dpos->hwaddr, kpos,
 						      data->dev)) {
-				return rc = -EMSGSIZE;
+				return -EMSGSIZE;
 			}
 
 			data->s_idx2++;
@@ -1209,7 +1209,7 @@ static int llsec_iter_devkeys(struct llsec_dump_data *data)
 		data->s_idx++;
 	}
 
-	return rc;
+	return 0;
 }
 
 int ieee802154_llsec_dump_devkeys(struct sk_buff *skb,
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw

Hello.

Quoted 40 lines · Yang Li

In order to keep the code style consistency of the whole file, redundant return value ‘rc’ and its assignments should be deleted

The clang_analyzer complains as follows:
net/ieee802154/nl-mac.c:1203:12: warning: Although the value stored to 'rc' is used in the enclosing expression, the value is never actually read from 'rc'

No functional change, only more efficient.

---
  net/ieee802154/nl-mac.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
net/ieee802154/nl-mac.c +2 -2
index 0c1b077..a6a8cf6 100644
@@ -1184,7 +1184,7 @@ static int llsec_iter_devkeys(struct llsec_dump_data *data)
  {
  	struct ieee802154_llsec_device *dpos;
  	struct ieee802154_llsec_device_key *kpos;
-	int rc = 0, idx = 0, idx2;
+	int idx = 0, idx2;
 
  	list_for_each_entry(dpos, &data->table->devices, list) {
  		if (idx++ < data->s_idx)
@@ -1200,7 +1200,7 @@ static int llsec_iter_devkeys(struct llsec_dump_data *data)
  						      data->nlmsg_seq,
  						      dpos->hwaddr, kpos,
  						      data->dev)) {
-				return rc = -EMSGSIZE;
+				return -EMSGSIZE;
  			}
 
  			data->s_idx2++;

net/ieee802154/nl-mac.c static int llsec_iter_devkeys(struct llsec_dump_data *data) · line 1215

Quoted 8 lines
net/ieee802154/nl-mac.c +1 -1
@@ -1209,7 +1209,7 @@ static int llsec_iter_devkeys(struct llsec_dump_data *data)
  		data->s_idx++;
  	}
 
-	return rc;
+	return 0;
  }
 
  int ieee802154_llsec_dump_devkeys(struct sk_buff *skb,

This patch has been applied to the wpan tree and will be part of the next pull request to net. Thanks!

regards
Stefan Schmidt