2012-05-07 19:30:36

by Il Han

[permalink] [raw]
Subject: [PATCH] brcm80211: Initialize a variable before used.

The variable val is used uninitialized.
It should be initialized before used.
Initialize it.

Signed-off-by: Il Han <[email protected]>
---
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
index c93ea35..d67c5c4 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
@@ -1141,7 +1141,7 @@ u32 ai_gpiocontrol(struct si_pub *sih, u32 mask, u32 val, u8 priority)
void ai_chipcontrl_epa4331(struct si_pub *sih, bool on)
{
struct bcma_device *cc;
- u32 val;
+ u32 val = 0;

cc = ai_findcore(sih, CC_CORE_ID, 0);

--
1.7.4.1



2012-05-07 20:11:15

by Franky Lin

[permalink] [raw]
Subject: Re: [PATCH] brcm80211: Initialize a variable before used.

Thanks Il. Removing the declaration and assignment line of val seems to
be better since it's not used afterward. Do you want to send out a V2?
Or I can do it.

Thanks,
Franky

On 05/07/2012 12:23 PM, Il Han wrote:
> The variable val is used uninitialized.
> It should be initialized before used.
> Initialize it.
>
> Signed-off-by: Il Han<[email protected]>
> ---
> drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
> index c93ea35..d67c5c4 100644
> --- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
> +++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
> @@ -1141,7 +1141,7 @@ u32 ai_gpiocontrol(struct si_pub *sih, u32 mask, u32 val, u8 priority)
> void ai_chipcontrl_epa4331(struct si_pub *sih, bool on)
> {
> struct bcma_device *cc;
> - u32 val;
> + u32 val = 0;
>
> cc = ai_findcore(sih, CC_CORE_ID, 0);
>