Subject: [PATCH] rtlwifi: rtl8821ae: Make sure loop counter is signed on all architectures

The for-loop condition does not work correctly on architectures where "char"
is unsigned. Fix it by using an "int", which may also result in more
efficient code.

Signed-off-by: David Müller <[email protected]>
---
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
index 74165b3..fcd84d1 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
@@ -959,7 +959,7 @@ static void _rtl8821ae_phy_store_txpower_by_rate_base(struct ieee80211_hw *hw)
static void _phy_convert_txpower_dbm_to_relative_value(u32 *data, u8 start,
u8 end, u8 base_val)
{
- char i = 0;
+ int i = 0;
u8 temp_value = 0;
u32 temp_data = 0;

--
2.7.4



2016-04-26 09:11:17

by Kalle Valo

[permalink] [raw]
Subject: Re: [v2] rtlwifi: rtl8821ae: Make sure loop counter is signed on allarchitectures


> The for-loop condition does not work correctly on architectures where
> "char" is unsigned. Fix it by using an "int", which may also result in
> more efficient code.
>
> v2: Remove unneeded initialization.
>
> Signed-off-by: David Müller <[email protected]>
> Acked-by: Larry Finger <[email protected]>

Thanks, applied to wireless-drivers-next.git.

Kalle Valo

2016-04-15 15:34:56

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH v2] rtlwifi: rtl8821ae: Make sure loop counter is signed on all architectures

On 04/15/2016 01:50 AM, David Müller wrote:
> The for-loop condition does not work correctly on architectures where
> "char" is unsigned. Fix it by using an "int", which may also result in
> more efficient code.
>
> v2: Remove unneeded initialization.
>
> Signed-off-by: David Müller <[email protected]>
> ---
> drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
> index 74165b3..1abd243 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
> @@ -959,7 +959,7 @@ static void _rtl8821ae_phy_store_txpower_by_rate_base(struct ieee80211_hw *hw)
> static void _phy_convert_txpower_dbm_to_relative_value(u32 *data, u8 start,
> u8 end, u8 base_val)
> {
> - char i = 0;
> + int i;
> u8 temp_value = 0;
> u32 temp_data = 0;

Acked-by: Larry Finger <[email protected]>

Thanks,

Larry



Subject: [PATCH v2] rtlwifi: rtl8821ae: Make sure loop counter is signed on all architectures

The for-loop condition does not work correctly on architectures where
"char" is unsigned. Fix it by using an "int", which may also result in
more efficient code.

v2: Remove unneeded initialization.

Signed-off-by: David Müller <[email protected]>
---
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
index 74165b3..1abd243 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
@@ -959,7 +959,7 @@ static void _rtl8821ae_phy_store_txpower_by_rate_base(struct ieee80211_hw *hw)
static void _phy_convert_txpower_dbm_to_relative_value(u32 *data, u8 start,
u8 end, u8 base_val)
{
- char i = 0;
+ int i;
u8 temp_value = 0;
u32 temp_data = 0;

--
2.7.4


2016-04-26 09:39:07

by Kalle Valo

[permalink] [raw]
Subject: Re: [v2] rtlwifi: rtl8821ae: Make sure loop counter is signed on allarchitectures

Kalle Valo <[email protected]> writes:

>> The for-loop condition does not work correctly on architectures where
>> "char" is unsigned. Fix it by using an "int", which may also result in
>> more efficient code.
>>
>> v2: Remove unneeded initialization.
>>
>> Signed-off-by: David Müller <[email protected]>
>> Acked-by: Larry Finger <[email protected]>
>
> Thanks, applied to wireless-drivers-next.git.

But afterwards I removed the change log. That doesn't belong to the
commit log, please add that after "---" line separator.

Also in patchwork your name has (ELSOFT AG), I edited that out.

--
Kalle Valo

2016-04-14 15:42:29

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH] rtlwifi: rtl8821ae: Make sure loop counter is signed on all architectures

On 04/14/2016 07:48 AM, David Müller wrote:
> The for-loop condition does not work correctly on architectures where "char"
> is unsigned. Fix it by using an "int", which may also result in more
> efficient code.
>
> Signed-off-by: David Müller <[email protected]>
> ---
> drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
> index 74165b3..fcd84d1 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
> @@ -959,7 +959,7 @@ static void _rtl8821ae_phy_store_txpower_by_rate_base(struct ieee80211_hw *hw)
> static void _phy_convert_txpower_dbm_to_relative_value(u32 *data, u8 start,
> u8 end, u8 base_val)
> {
> - char i = 0;
> + int i = 0;
> u8 temp_value = 0;
> u32 temp_data = 0;

This change is OK, but as long as you are touching this line, you should remove
the initialization to zero. The first executable statement of that routine is
"for (i = 3; i >= 0; --i)", thus there is no possibility that the variable could
be used without being initialized.


Thanks,

Larry