diff mbox

net: wireless: rtlwifi: rtl8192de: phy.c: Cleaning up uninitialized variables

Message ID 1401626948-16183-1-git-send-email-rickard_strandqvist@spectrumdigital.se (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Rickard Strandqvist June 1, 2014, 12:49 p.m. UTC
There is a risk that the variable will be used without being initialized.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/net/wireless/rtlwifi/rtl8192de/phy.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sergei Shtylyov June 1, 2014, 4:38 p.m. UTC | #1
Hello.

On 06/01/2014 04:49 PM, Rickard Strandqvist wrote:

> There is a risk that the variable will be used without being initialized.

> This was largely found by using a static code analysis program called cppcheck.

> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
>   drivers/net/wireless/rtlwifi/rtl8192de/phy.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
> index 3d1f0dd..66abaf6 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
> @@ -203,11 +203,11 @@ u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask)
>   	struct rtl_priv *rtlpriv = rtl_priv(hw);
>   	struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
>   	u32 returnvalue, originalvalue, bitshift;
> -	u8 dbi_direct;
>
>   	RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "regaddr(%#x), bitmask(%#x)\n",
>   		 regaddr, bitmask);
>   	if (rtlhal->during_mac1init_radioa || rtlhal->during_mac0init_radiob) {
> +		u8 dbi_direct = 0;

    Empty line is needed here, after declarations, like above.

>   		/* mac1 use phy0 read radio_b. */
>   		/* mac0 use phy1 read radio_b. */
>   		if (rtlhal->during_mac1init_radioa)

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rickard Strandqvist June 1, 2014, 4:44 p.m. UTC | #2
Hi Sergei!

Okay, sorry. But you agree with what it is doing in general then?

In this case, I am sending a new patch...

Best regards
Rickard Strandqvist


2014-06-01 18:38 GMT+02:00 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>:
> Hello.
>
>
> On 06/01/2014 04:49 PM, Rickard Strandqvist wrote:
>
>> There is a risk that the variable will be used without being initialized.
>
>
>> This was largely found by using a static code analysis program called
>> cppcheck.
>
>
>> Signed-off-by: Rickard Strandqvist
>> <rickard_strandqvist@spectrumdigital.se>
>> ---
>>   drivers/net/wireless/rtlwifi/rtl8192de/phy.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>
>
>> diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
>> b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
>> index 3d1f0dd..66abaf6 100644
>> --- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
>> +++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
>> @@ -203,11 +203,11 @@ u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw,
>> u32 regaddr, u32 bitmask)
>>         struct rtl_priv *rtlpriv = rtl_priv(hw);
>>         struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
>>         u32 returnvalue, originalvalue, bitshift;
>> -       u8 dbi_direct;
>>
>>         RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "regaddr(%#x),
>> bitmask(%#x)\n",
>>                  regaddr, bitmask);
>>         if (rtlhal->during_mac1init_radioa ||
>> rtlhal->during_mac0init_radiob) {
>> +               u8 dbi_direct = 0;
>
>
>    Empty line is needed here, after declarations, like above.
>
>
>>                 /* mac1 use phy0 read radio_b. */
>>                 /* mac0 use phy1 read radio_b. */
>>                 if (rtlhal->during_mac1init_radioa)
>
>
> WBR, Sergei
>
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov June 1, 2014, 7:32 p.m. UTC | #3
Hello.

On 06/01/2014 08:44 PM, Rickard Strandqvist wrote:

> Okay, sorry. But you agree with what it is doing in general then?

    Now that you asked, I do agree. But generally my reply doesn't mean that I 
went and studied the patch context and verified that the patch is indeed correct.

> In this case, I am sending a new patch...

    BTW, it's worth mentioning in the change log that you're moving the 
variable in question into the block.

> Best regards
> Rickard Strandqvist

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
index 3d1f0dd..66abaf6 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
@@ -203,11 +203,11 @@  u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask)
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 	struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
 	u32 returnvalue, originalvalue, bitshift;
-	u8 dbi_direct;
 
 	RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "regaddr(%#x), bitmask(%#x)\n",
 		 regaddr, bitmask);
 	if (rtlhal->during_mac1init_radioa || rtlhal->during_mac0init_radiob) {
+		u8 dbi_direct = 0;
 		/* mac1 use phy0 read radio_b. */
 		/* mac0 use phy1 read radio_b. */
 		if (rtlhal->during_mac1init_radioa)