2019-10-31 13:51:33

by zhong jiang

[permalink] [raw]
Subject: [PATCH 0/3] wireless: remove unneeded variable and return 0

The issue is detected with help of coccinelle

zhong jiang (3):
ipw2x00: Remove redundant variable "rc"
iwlegacy: Remove redundant variable "ret"
b43legacy: ASoC: ux500: Remove redundant variable "count"

drivers/net/wireless/broadcom/b43legacy/debugfs.c | 9 +++------
drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 4 ++--
drivers/net/wireless/intel/iwlegacy/4965-mac.c | 3 +--
3 files changed, 6 insertions(+), 10 deletions(-)

--
1.7.12.4


2019-10-31 13:53:36

by zhong jiang

[permalink] [raw]
Subject: [PATCH 1/3] ipw2x00: Remove redundant variable "rc"

local variable "rc" is not used. hence it is safe to remove and
just return 0.

Signed-off-by: zhong jiang <[email protected]>
---
drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
index 34cfd81..df0f37e4 100644
--- a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
+++ b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
@@ -1005,7 +1005,6 @@ static int libipw_qos_convert_ac_to_parameters(struct
libipw_qos_parameters
*qos_param)
{
- int rc = 0;
int i;
struct libipw_qos_ac_parameter *ac_params;
u32 txop;
@@ -1030,7 +1029,8 @@ static int libipw_qos_convert_ac_to_parameters(struct
txop = le16_to_cpu(ac_params->tx_op_limit) * 32;
qos_param->tx_op_limit[i] = cpu_to_le16(txop);
}
- return rc;
+
+ return 0;
}

/*
--
1.7.12.4

2019-10-31 22:47:33

by Simon Horman

[permalink] [raw]
Subject: Re: [PATCH 1/3] ipw2x00: Remove redundant variable "rc"

On Thu, Oct 31, 2019 at 09:46:18PM +0800, zhong jiang wrote:
> local variable "rc" is not used. hence it is safe to remove and
> just return 0.
>
> Signed-off-by: zhong jiang <[email protected]>

It appears that there is only one caller of
libipw_qos_convert_ac_to_parameters() and that it ignores the return value
(which, as you point out is always 0).

Perhaps it would be cleaner if the return type of
libipw_qos_convert_ac_to_parameters() was void.

> ---
> drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
> index 34cfd81..df0f37e4 100644
> --- a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
> +++ b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
> @@ -1005,7 +1005,6 @@ static int libipw_qos_convert_ac_to_parameters(struct
> libipw_qos_parameters
> *qos_param)
> {
> - int rc = 0;
> int i;
> struct libipw_qos_ac_parameter *ac_params;
> u32 txop;
> @@ -1030,7 +1029,8 @@ static int libipw_qos_convert_ac_to_parameters(struct
> txop = le16_to_cpu(ac_params->tx_op_limit) * 32;
> qos_param->tx_op_limit[i] = cpu_to_le16(txop);
> }
> - return rc;
> +
> + return 0;
> }
>
> /*
> --
> 1.7.12.4
>

2019-11-01 01:49:46

by zhong jiang

[permalink] [raw]
Subject: Re: [PATCH 1/3] ipw2x00: Remove redundant variable "rc"

On 2019/11/1 4:44, Simon Horman wrote:
> On Thu, Oct 31, 2019 at 09:46:18PM +0800, zhong jiang wrote:
>> local variable "rc" is not used. hence it is safe to remove and
>> just return 0.
>>
>> Signed-off-by: zhong jiang <[email protected]>
> It appears that there is only one caller of
> libipw_qos_convert_ac_to_parameters() and that it ignores the return value
> (which, as you point out is always 0).
>
> Perhaps it would be cleaner if the return type of
> libipw_qos_convert_ac_to_parameters() was void.
will do in V2, Thanks
>> ---
>> drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
>> index 34cfd81..df0f37e4 100644
>> --- a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
>> +++ b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
>> @@ -1005,7 +1005,6 @@ static int libipw_qos_convert_ac_to_parameters(struct
>> libipw_qos_parameters
>> *qos_param)
>> {
>> - int rc = 0;
>> int i;
>> struct libipw_qos_ac_parameter *ac_params;
>> u32 txop;
>> @@ -1030,7 +1029,8 @@ static int libipw_qos_convert_ac_to_parameters(struct
>> txop = le16_to_cpu(ac_params->tx_op_limit) * 32;
>> qos_param->tx_op_limit[i] = cpu_to_le16(txop);
>> }
>> - return rc;
>> +
>> + return 0;
>> }
>>
>> /*
>> --
>> 1.7.12.4
>>
> .
>