* [PATCH] Fix uninitialized variable in ath6kl ath6kl_sdio_enable_scatter
@ 2012-09-03 20:15 Andi Kleen
2012-09-21 16:41 ` Kalle Valo
0 siblings, 1 reply; 2+ messages in thread
From: Andi Kleen @ 2012-09-03 20:15 UTC (permalink / raw)
To: kvalo, linux-wireless, linux-kernel
gcc 4.8 warns
/backup/lsrc/git/linux-lto-2.6/drivers/net/wireless/ath/ath6kl/sdio.c:
In function 'ath6kl_sdio_enable_scatter':
/backup/lsrc/git/linux-lto-2.6/drivers/net/wireless/ath/ath6kl/sdio.c:748:16:
warning: 'ret' may be used uninitialized in this function
[-Wmaybe-uninitialized]
if (virt_scat || ret) {
^
The variable can indeed be uninitialized when the previous if branch is
skipped. I just set it to zero for now. I'm not fully sure the fix is
correct, maybe the || should be an && ?
Signed-off-by: Andi Kleen <ak@linux.intel.com>
diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
index 05b9540..f495899 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -709,7 +709,7 @@ static int ath6kl_sdio_enable_scatter(struct ath6kl *ar)
{
struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar);
struct htc_target *target = ar->htc_target;
- int ret;
+ int ret = 0;
bool virt_scat = false;
if (ar_sdio->scatter_enabled)
--
ak@linux.intel.com -- Speaking for myself only.
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] Fix uninitialized variable in ath6kl ath6kl_sdio_enable_scatter
2012-09-03 20:15 [PATCH] Fix uninitialized variable in ath6kl ath6kl_sdio_enable_scatter Andi Kleen
@ 2012-09-21 16:41 ` Kalle Valo
0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2012-09-21 16:41 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-wireless, linux-kernel, ath6kl-devel
On 09/03/2012 11:15 PM, Andi Kleen wrote:
> gcc 4.8 warns
>
> /backup/lsrc/git/linux-lto-2.6/drivers/net/wireless/ath/ath6kl/sdio.c:
> In function 'ath6kl_sdio_enable_scatter':
> /backup/lsrc/git/linux-lto-2.6/drivers/net/wireless/ath/ath6kl/sdio.c:748:16:
> warning: 'ret' may be used uninitialized in this function
> [-Wmaybe-uninitialized]
> if (virt_scat || ret) {
> ^
>
> The variable can indeed be uninitialized when the previous if branch is
> skipped. I just set it to zero for now. I'm not fully sure the fix is
> correct, maybe the || should be an && ?
>From a quick look || should be correct, but of course I might be missing
something. I think your patch is correct way to fix this.
Thanks, applied to ath6kl.git. I just added "ath6kl:" prefix to the title.
Kalle
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-21 16:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-03 20:15 [PATCH] Fix uninitialized variable in ath6kl ath6kl_sdio_enable_scatter Andi Kleen
2012-09-21 16:41 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).