linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] ath6kl_sdio: Initialize sg_sz to fix a compilation warning
@ 2012-03-15  7:45 Vivek Natarajan
  2012-03-20  8:15 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Vivek Natarajan @ 2012-03-15  7:45 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless

Fix uninitialized variable warning on compilation.

sdio.c:333: warning: 'sg_sz' may be used uninitialized in this function

Signed-off-by: Vivek Natarajan <nataraja@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath6kl/sdio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
index 5a03082..fe6c9d8 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -335,7 +335,7 @@ static int ath6kl_sdio_alloc_prep_scat_req(struct ath6kl_sdio *ar_sdio,
 {
 	struct hif_scatter_req *s_req;
 	struct bus_request *bus_req;
-	int i, scat_req_sz, scat_list_sz, sg_sz, buf_sz;
+	int i, scat_req_sz, scat_list_sz, sg_sz = 0, buf_sz;
 	u8 *virt_buf;
 
 	scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] ath6kl_sdio: Initialize sg_sz to fix a compilation warning
  2012-03-15  7:45 [PATCH 2/2] ath6kl_sdio: Initialize sg_sz to fix a compilation warning Vivek Natarajan
@ 2012-03-20  8:15 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2012-03-20  8:15 UTC (permalink / raw)
  To: Vivek Natarajan; +Cc: linux-wireless, ath6kl-devel

On 03/15/2012 09:45 AM, Vivek Natarajan wrote:
> Fix uninitialized variable warning on compilation.
> 
> sdio.c:333: warning: 'sg_sz' may be used uninitialized in this function
> 
> Signed-off-by: Vivek Natarajan <nataraja@qca.qualcomm.com>
> ---
>  drivers/net/wireless/ath/ath6kl/sdio.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
> index 5a03082..fe6c9d8 100644
> --- a/drivers/net/wireless/ath/ath6kl/sdio.c
> +++ b/drivers/net/wireless/ath/ath6kl/sdio.c
> @@ -335,7 +335,7 @@ static int ath6kl_sdio_alloc_prep_scat_req(struct ath6kl_sdio *ar_sdio,
>  {
>  	struct hif_scatter_req *s_req;
>  	struct bus_request *bus_req;
> -	int i, scat_req_sz, scat_list_sz, sg_sz, buf_sz;
> +	int i, scat_req_sz, scat_list_sz, sg_sz = 0, buf_sz;
>  	u8 *virt_buf;
>  
>  	scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item);

I also see this false warning on an older arm gcc, but not with
4.4.4-14ubuntu5 for x86.

But initialising variables due to buggy gcc is not a good idea. If you
want to get rid of the warning this would be better as the if clause is
not really necessary:

--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -341,11 +341,8 @@ static int ath6kl_sdio_alloc_prep_scat_req(struct
ath6kl_sdio *ar_sdio,
        scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item);
        scat_req_sz = sizeof(*s_req) + scat_list_sz;

-       if (!virt_scat)
-               sg_sz = sizeof(struct scatterlist) * n_scat_entry;
-       else
-               buf_sz =  2 * L1_CACHE_BYTES +
-                         ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER;
+       sg_sz = sizeof(struct scatterlist) * n_scat_entry;
+       buf_sz =  2 * L1_CACHE_BYTES + ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER;

        for (i = 0; i < n_scat_req; i++) {
                /* allocate the scatter request */

Kalle

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-20  8:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-15  7:45 [PATCH 2/2] ath6kl_sdio: Initialize sg_sz to fix a compilation warning Vivek Natarajan
2012-03-20  8:15 ` 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).