From: Andi Kleen Date: Mon, 3 Sep 2012 20:15:36 +0000 (+0200) Subject: ath6kl: fix uninitialized variable in ath6kl_sdio_enable_scatter() X-Git-Tag: v3.2.101~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2d4436a69c3570419680ee75b431d2d9af26254;p=thirdparty%2Fkernel%2Fstable.git ath6kl: fix uninitialized variable in ath6kl_sdio_enable_scatter() commit 527f6570300980251e818e80865b437eefb4e5d3 upstream. 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 Signed-off-by: Kalle Valo Signed-off-by: Ben Hutchings --- diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c index 066d4f88807fa..10a1183f7841b 100644 --- a/drivers/net/wireless/ath/ath6kl/sdio.c +++ b/drivers/net/wireless/ath/ath6kl/sdio.c @@ -670,7 +670,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; /* check if host supports scatter and it meets our requirements */