Skip to contentSkip to conversation

Fix uninitialized variable in ath6kl ath6kl_sdio_enable_scatter

PATCH Applied Andi Kleen 2 participants 2 messages Sep 3, 2012 – Sep 21, 2012 Atheros ATH6KL wireless driver

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Fix uninitialized variable in ath6kl ath6kl_sdio_enable_scatter

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 && ?

drivers/net/wireless/ath/ath6kl/sdio.c +1 -1
index 05b9540..f495899 100644
@@ -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)
Signature · 1 line
[email protected] -- Speaking for myself only.
Applied
#1 lore raw
Quoted 7 lines · Andi Kleen

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]

Quoted 8 lines
  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