diff mbox series

ieee802154: remove a redundant local variable 'i'

Message ID 1537368097-60101-1-git-send-email-zhongjiang@huawei.com
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show
Series ieee802154: remove a redundant local variable 'i' | expand

Commit Message

zhong jiang Sept. 19, 2018, 2:41 p.m. UTC
The local variable 'i' is never used after being assigned.
hence it should be redundant adn can be removed.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 net/ieee802154/nl802154.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Stefan Schmidt Sept. 27, 2018, 2:47 p.m. UTC | #1
Hello.

On 19/09/2018 16:41, zhong jiang wrote:
> The local variable 'i' is never used after being assigned.
> hence it should be redundant adn can be removed.
> 
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  net/ieee802154/nl802154.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
> index 99f6c25..5b90151 100644
> --- a/net/ieee802154/nl802154.c
> +++ b/net/ieee802154/nl802154.c
> @@ -445,7 +445,6 @@ static int nl802154_send_wpan_phy(struct cfg802154_registered_device *rdev,
>  {
>  	struct nlattr *nl_cmds;
>  	void *hdr;
> -	int i;
>  
>  	hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
>  	if (!hdr)
> @@ -508,7 +507,6 @@ static int nl802154_send_wpan_phy(struct cfg802154_registered_device *rdev,
>  	if (!nl_cmds)
>  		goto nla_put_failure;
>  
> -	i = 0;
>  #define CMD(op, n)							\
>  	do {								\
>  		if (rdev->ops->op) {					\
> 

Sorry, but this patch is wrong. The variable i is used in line 513
inside the CMD() macro. The compiler clearly tells this when running
with your patch:

net/ieee802154/nl802154.c: In function ‘nl802154_send_wpan_phy’:
net/ieee802154/nl802154.c:513:4: error: ‘i’ undeclared (first use in
this function)

I would appreciate if patches sent out would at least be compile tested.

regards
Stefan Schmidt
zhong jiang Sept. 28, 2018, 6:37 a.m. UTC | #2
On 2018/9/27 22:47, Stefan Schmidt wrote:
> Hello.
>
> On 19/09/2018 16:41, zhong jiang wrote:
>> The local variable 'i' is never used after being assigned.
>> hence it should be redundant adn can be removed.
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> ---
>>  net/ieee802154/nl802154.c | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
>> index 99f6c25..5b90151 100644
>> --- a/net/ieee802154/nl802154.c
>> +++ b/net/ieee802154/nl802154.c
>> @@ -445,7 +445,6 @@ static int nl802154_send_wpan_phy(struct cfg802154_registered_device *rdev,
>>  {
>>  	struct nlattr *nl_cmds;
>>  	void *hdr;
>> -	int i;
>>  
>>  	hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
>>  	if (!hdr)
>> @@ -508,7 +507,6 @@ static int nl802154_send_wpan_phy(struct cfg802154_registered_device *rdev,
>>  	if (!nl_cmds)
>>  		goto nla_put_failure;
>>  
>> -	i = 0;
>>  #define CMD(op, n)							\
>>  	do {								\
>>  		if (rdev->ops->op) {					\
>>
> Sorry, but this patch is wrong. The variable i is used in line 513
> inside the CMD() macro. The compiler clearly tells this when running
> with your patch:
>
> net/ieee802154/nl802154.c: In function ‘nl802154_send_wpan_phy’:
> net/ieee802154/nl802154.c:513:4: error: ‘i’ undeclared (first use in
> this function)
>
> I would appreciate if patches sent out would at least be compile tested.
Sorry, I really double check and compile test.

Thanks,
zhong jiang
> regards
> Stefan Schmidt
>
> .
>
diff mbox series

Patch

diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 99f6c25..5b90151 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -445,7 +445,6 @@  static int nl802154_send_wpan_phy(struct cfg802154_registered_device *rdev,
 {
 	struct nlattr *nl_cmds;
 	void *hdr;
-	int i;
 
 	hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
 	if (!hdr)
@@ -508,7 +507,6 @@  static int nl802154_send_wpan_phy(struct cfg802154_registered_device *rdev,
 	if (!nl_cmds)
 		goto nla_put_failure;
 
-	i = 0;
 #define CMD(op, n)							\
 	do {								\
 		if (rdev->ops->op) {					\