linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/ieee802154: drop unneeded assignment in llsec_iter_devkeys()
@ 2021-04-25 10:24 Yang Li
  2021-06-03  8:21 ` Stefan Schmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2021-04-25 10:24 UTC (permalink / raw)
  To: alex.aring; +Cc: stefan, davem, kuba, linux-wpan, netdev, linux-kernel, Yang Li

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=n, Size: 1486 bytes --]

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.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 net/ieee802154/nl-mac.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c
index 0c1b077..a6a8cf6 100644
--- a/net/ieee802154/nl-mac.c
+++ b/net/ieee802154/nl-mac.c
@@ -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,
-- 
1.8.3.1


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

* Re: [PATCH] net/ieee802154: drop unneeded assignment in llsec_iter_devkeys()
  2021-04-25 10:24 [PATCH] net/ieee802154: drop unneeded assignment in llsec_iter_devkeys() Yang Li
@ 2021-06-03  8:21 ` Stefan Schmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Schmidt @ 2021-06-03  8:21 UTC (permalink / raw)
  To: Yang Li, alex.aring; +Cc: davem, kuba, linux-wpan, netdev, linux-kernel

Hello.

On 25.04.21 12:24, Yang Li wrote:
> 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.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>   net/ieee802154/nl-mac.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c
> index 0c1b077..a6a8cf6 100644
> --- a/net/ieee802154/nl-mac.c
> +++ b/net/ieee802154/nl-mac.c
> @@ -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,
> 

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

regards
Stefan Schmidt

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

end of thread, other threads:[~2021-06-03  8:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-25 10:24 [PATCH] net/ieee802154: drop unneeded assignment in llsec_iter_devkeys() Yang Li
2021-06-03  8:21 ` Stefan Schmidt

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).