All of lore.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: "David Müller" <d.mueller@elsoft.ch>, linux-wireless@vger.kernel.org
Subject: Re: [PATCH] rtlwifi: rtl8821ae: Make sure loop counter is signed on all architectures
Date: Thu, 14 Apr 2016 10:42:26 -0500	[thread overview]
Message-ID: <570FBA62.6080606@lwfinger.net> (raw)
In-Reply-To: <1460638123-2913-1-git-send-email-d.mueller@elsoft.ch>

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 <d.mueller@elsoft.ch>
> ---
>   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


  reply	other threads:[~2016-04-14 15:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-14 12:48 [PATCH] rtlwifi: rtl8821ae: Make sure loop counter is signed on all architectures David Müller
2016-04-14 15:42 ` Larry Finger [this message]
2016-04-15  6:50   ` [PATCH v2] " David Müller
2016-04-15 15:34     ` Larry Finger
2016-04-26  9:11     ` [v2] rtlwifi: rtl8821ae: Make sure loop counter is signed on allarchitectures Kalle Valo
2016-04-26  9:39       ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=570FBA62.6080606@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=d.mueller@elsoft.ch \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.