2016-01-01 18:21:28

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 0/2] net-ath9k_htc: Fine-tuning for two function implementations

From: Markus Elfring <[email protected]>
Date: Fri, 1 Jan 2016 19:16:05 +0100

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
Delete an unnecessary variable initialisation in ath9k_hif_usb_rx_stream()
Replace a variable initialisation by an assignment in ath9k_htc_set_channel()

drivers/net/wireless/ath/ath9k/hif_usb.c | 2 +-
drivers/net/wireless/ath/ath9k/htc_drv_main.c | 7 ++-----
2 files changed, 3 insertions(+), 6 deletions(-)

--
2.6.3



2016-01-01 19:15:03

by Oleksij Rempel

[permalink] [raw]
Subject: Re: [PATCH 1/2] net-ath9k_htc: Delete an unnecessary variable initialisation in ath9k_hif_usb_rx_stream()

Am 01.01.2016 um 19:23 schrieb SF Markus Elfring:
> From: Markus Elfring <[email protected]>
> Date: Fri, 1 Jan 2016 19:00:53 +0100
>
> Omit explicit initialisation at the beginning for one local variable
> that is redefined before its first use.
>
> Signed-off-by: Markus Elfring <[email protected]>
> ---
> drivers/net/wireless/ath/ath9k/hif_usb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
> index 165dd20..51bd61b 100644
> --- a/drivers/net/wireless/ath/ath9k/hif_usb.c
> +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
> @@ -525,7 +525,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
> struct sk_buff *skb)
> {
> struct sk_buff *nskb, *skb_pool[MAX_PKT_NUM_IN_TRANSFER];
> - int index = 0, i = 0, len = skb->len;
> + int index = 0, i, len = skb->len;
> int rx_remain_len, rx_pkt_len;
> u16 pool_index = 0;
> u8 *ptr;
>


Reviewed-by: Oleksij Rempel <[email protected]>

--
Regards,
Oleksij


Attachments:
signature.asc (213.00 B)
OpenPGP digital signature

2016-01-01 18:23:45

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 1/2] net-ath9k_htc: Delete an unnecessary variable initialisation in ath9k_hif_usb_rx_stream()

From: Markus Elfring <[email protected]>
Date: Fri, 1 Jan 2016 19:00:53 +0100

Omit explicit initialisation at the beginning for one local variable
that is redefined before its first use.

Signed-off-by: Markus Elfring <[email protected]>
---
drivers/net/wireless/ath/ath9k/hif_usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 165dd20..51bd61b 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -525,7 +525,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
struct sk_buff *skb)
{
struct sk_buff *nskb, *skb_pool[MAX_PKT_NUM_IN_TRANSFER];
- int index = 0, i = 0, len = skb->len;
+ int index = 0, i, len = skb->len;
int rx_remain_len, rx_pkt_len;
u16 pool_index = 0;
u8 *ptr;
--
2.6.3


2016-01-01 18:25:08

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 2/2] net-ath9k_htc: Replace a variable initialisation by an assignment in ath9k_htc_set_channel()

From: Markus Elfring <[email protected]>
Date: Fri, 1 Jan 2016 19:09:32 +0100

Replace an explicit initialisation for one local variable at the beginning
by a conditional assignment.

Signed-off-by: Markus Elfring <[email protected]>
---
drivers/net/wireless/ath/ath9k/htc_drv_main.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index a680a97..30bd59e 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -246,7 +246,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
struct ieee80211_conf *conf = &common->hw->conf;
bool fastcc;
struct ieee80211_channel *channel = hw->conf.chandef.chan;
- struct ath9k_hw_cal_data *caldata = NULL;
+ struct ath9k_hw_cal_data *caldata;
enum htc_phymode mode;
__be16 htc_mode;
u8 cmd_rsp;
@@ -274,10 +274,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
priv->ah->curchan->channel,
channel->center_freq, conf_is_ht(conf), conf_is_ht40(conf),
fastcc);
-
- if (!fastcc)
- caldata = &priv->caldata;
-
+ caldata = fastcc ? NULL : &priv->caldata;
ret = ath9k_hw_reset(ah, hchan, caldata, fastcc);
if (ret) {
ath_err(common,
--
2.6.3


2016-01-01 19:14:56

by Oleksij Rempel

[permalink] [raw]
Subject: Re: [PATCH 2/2] net-ath9k_htc: Replace a variable initialisation by an assignment in ath9k_htc_set_channel()

Am 01.01.2016 um 19:25 schrieb SF Markus Elfring:
> From: Markus Elfring <[email protected]>
> Date: Fri, 1 Jan 2016 19:09:32 +0100
>
> Replace an explicit initialisation for one local variable at the beginning
> by a conditional assignment.
>
> Signed-off-by: Markus Elfring <[email protected]>
> ---
> drivers/net/wireless/ath/ath9k/htc_drv_main.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> index a680a97..30bd59e 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> @@ -246,7 +246,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
> struct ieee80211_conf *conf = &common->hw->conf;
> bool fastcc;
> struct ieee80211_channel *channel = hw->conf.chandef.chan;
> - struct ath9k_hw_cal_data *caldata = NULL;
> + struct ath9k_hw_cal_data *caldata;
> enum htc_phymode mode;
> __be16 htc_mode;
> u8 cmd_rsp;
> @@ -274,10 +274,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
> priv->ah->curchan->channel,
> channel->center_freq, conf_is_ht(conf), conf_is_ht40(conf),
> fastcc);
> -
> - if (!fastcc)
> - caldata = &priv->caldata;
> -
> + caldata = fastcc ? NULL : &priv->caldata;
> ret = ath9k_hw_reset(ah, hchan, caldata, fastcc);
> if (ret) {
> ath_err(common,
>

Reviewed-by: Oleksij Rempel <[email protected]>

--
Regards,
Oleksij


Attachments:
signature.asc (213.00 B)
OpenPGP digital signature

2016-04-19 16:13:28

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 2/2] net-ath9k_htc: Replace a variable initialisation by an assignment in ath9k_htc_set_channel()

Julian Calaby <[email protected]> writes:

> On Sat, Jan 2, 2016 at 5:25 AM, SF Markus Elfring
> <[email protected]> wrote:
>> From: Markus Elfring <[email protected]>
>> Date: Fri, 1 Jan 2016 19:09:32 +0100
>>
>> Replace an explicit initialisation for one local variable at the beginning
>> by a conditional assignment.
>>
>> Signed-off-by: Markus Elfring <[email protected]>
>
> This looks sane to me.
>
> Reviewed-by: Julian Calaby <[email protected]>

Applied, thanks.

--
Kalle Valo

2016-04-15 14:34:46

by Julian Calaby

[permalink] [raw]
Subject: Re: [PATCH 2/2] net-ath9k_htc: Replace a variable initialisation by an assignment in ath9k_htc_set_channel()

Hi Kalle,

On Fri, Apr 15, 2016 at 10:09 PM, Kalle Valo <[email protected]> wrote:
> Julian Calaby <[email protected]> writes:
>
>> Hi Kalle,
>>
>> On Sat, Jan 2, 2016 at 5:25 AM, SF Markus Elfring
>> <[email protected]> wrote:
>>> From: Markus Elfring <[email protected]>
>>> Date: Fri, 1 Jan 2016 19:09:32 +0100
>>>
>>> Replace an explicit initialisation for one local variable at the beginning
>>> by a conditional assignment.
>>>
>>> Signed-off-by: Markus Elfring <[email protected]>
>>
>> This looks sane to me.
>>
>> Reviewed-by: Julian Calaby <[email protected]>
>
> Before I commit I'll just change the commit title to:
>
> ath9k_htc: Replace a variable initialisation by an assignment in ath9k_htc_set_channel()

Sounds good to me.

Thanks,

--
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/

2016-04-15 12:09:30

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 2/2] net-ath9k_htc: Replace a variable initialisation by an assignment in ath9k_htc_set_channel()

Julian Calaby <[email protected]> writes:

> Hi Kalle,
>
> On Sat, Jan 2, 2016 at 5:25 AM, SF Markus Elfring
> <[email protected]> wrote:
>> From: Markus Elfring <[email protected]>
>> Date: Fri, 1 Jan 2016 19:09:32 +0100
>>
>> Replace an explicit initialisation for one local variable at the beginning
>> by a conditional assignment.
>>
>> Signed-off-by: Markus Elfring <[email protected]>
>
> This looks sane to me.
>
> Reviewed-by: Julian Calaby <[email protected]>

Before I commit I'll just change the commit title to:

ath9k_htc: Replace a variable initialisation by an assignment in ath9k_htc_set_channel()

--
Kalle Valo

2016-04-08 01:41:07

by Julian Calaby

[permalink] [raw]
Subject: Re: [PATCH 2/2] net-ath9k_htc: Replace a variable initialisation by an assignment in ath9k_htc_set_channel()

Hi Kalle,

On Sat, Jan 2, 2016 at 5:25 AM, SF Markus Elfring
<[email protected]> wrote:
> From: Markus Elfring <[email protected]>
> Date: Fri, 1 Jan 2016 19:09:32 +0100
>
> Replace an explicit initialisation for one local variable at the beginning
> by a conditional assignment.
>
> Signed-off-by: Markus Elfring <[email protected]>

This looks sane to me.

Reviewed-by: Julian Calaby <[email protected]>

Thanks,

Julian Calaby

> ---
> drivers/net/wireless/ath/ath9k/htc_drv_main.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> index a680a97..30bd59e 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> @@ -246,7 +246,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
> struct ieee80211_conf *conf = &common->hw->conf;
> bool fastcc;
> struct ieee80211_channel *channel = hw->conf.chandef.chan;
> - struct ath9k_hw_cal_data *caldata = NULL;
> + struct ath9k_hw_cal_data *caldata;
> enum htc_phymode mode;
> __be16 htc_mode;
> u8 cmd_rsp;
> @@ -274,10 +274,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
> priv->ah->curchan->channel,
> channel->center_freq, conf_is_ht(conf), conf_is_ht40(conf),
> fastcc);
> -
> - if (!fastcc)
> - caldata = &priv->caldata;
> -
> + caldata = fastcc ? NULL : &priv->caldata;
> ret = ath9k_hw_reset(ah, hchan, caldata, fastcc);
> if (ret) {
> ath_err(common,
> --
> 2.6.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html



--
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/