aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRahul Lakkireddy <rahul.lakkireddy@chelsio.com>2018-01-24 03:01:05 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-24 10:56:59 -0500
commit325694e6c3484959d066d5c0e9bff4c5966491a3 (patch)
tree2da504879fe5907464ec7278345ea831c4150fcc
parenta1cf9c9ffe652a4f109eb2cd8e69d8fcdb855d00 (diff)
cxgb4: properly initialize variables
memset variables to 0 to fix sparse warnings: drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c:409:42: sparse: Using plain integer as NULL pointer drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.c:43:47: sparse: Using plain integer as NULL pointer Fixes: ad75b7d32f25 ("cxgb4: implement ethtool dump data operations") Fixes: 91c1953de387 ("cxgb4: use zlib deflate to compress firmware dump") Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.c3
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.c
index 4c3854cbeb6c..25cc06d75cff 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.c
@@ -40,8 +40,8 @@ int cudbg_compress_buff(struct cudbg_init *pdbg_init,
40 struct cudbg_buffer *pin_buff, 40 struct cudbg_buffer *pin_buff,
41 struct cudbg_buffer *pout_buff) 41 struct cudbg_buffer *pout_buff)
42{ 42{
43 struct z_stream_s compress_stream = { 0 };
44 struct cudbg_buffer temp_buff = { 0 }; 43 struct cudbg_buffer temp_buff = { 0 };
44 struct z_stream_s compress_stream;
45 struct cudbg_compress_hdr *c_hdr; 45 struct cudbg_compress_hdr *c_hdr;
46 int rc; 46 int rc;
47 47
@@ -53,6 +53,7 @@ int cudbg_compress_buff(struct cudbg_init *pdbg_init,
53 c_hdr = (struct cudbg_compress_hdr *)temp_buff.data; 53 c_hdr = (struct cudbg_compress_hdr *)temp_buff.data;
54 c_hdr->compress_id = CUDBG_ZLIB_COMPRESS_ID; 54 c_hdr->compress_id = CUDBG_ZLIB_COMPRESS_ID;
55 55
56 memset(&compress_stream, 0, sizeof(struct z_stream_s));
56 compress_stream.workspace = pdbg_init->workspace; 57 compress_stream.workspace = pdbg_init->workspace;
57 rc = zlib_deflateInit2(&compress_stream, Z_DEFAULT_COMPRESSION, 58 rc = zlib_deflateInit2(&compress_stream, Z_DEFAULT_COMPRESSION,
58 Z_DEFLATED, CUDBG_ZLIB_WIN_BITS, 59 Z_DEFLATED, CUDBG_ZLIB_WIN_BITS,
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c
index 9e0a8a8186c4..30485f9a598f 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c
@@ -406,14 +406,15 @@ static void cudbg_free_compress_buff(struct cudbg_init *pdbg_init)
406int cxgb4_cudbg_collect(struct adapter *adap, void *buf, u32 *buf_size, 406int cxgb4_cudbg_collect(struct adapter *adap, void *buf, u32 *buf_size,
407 u32 flag) 407 u32 flag)
408{ 408{
409 struct cudbg_init cudbg_init = { 0 };
410 struct cudbg_buffer dbg_buff = { 0 }; 409 struct cudbg_buffer dbg_buff = { 0 };
411 u32 size, min_size, total_size = 0; 410 u32 size, min_size, total_size = 0;
411 struct cudbg_init cudbg_init;
412 struct cudbg_hdr *cudbg_hdr; 412 struct cudbg_hdr *cudbg_hdr;
413 int rc; 413 int rc;
414 414
415 size = *buf_size; 415 size = *buf_size;
416 416
417 memset(&cudbg_init, 0, sizeof(struct cudbg_init));
417 cudbg_init.adap = adap; 418 cudbg_init.adap = adap;
418 cudbg_init.outbuf = buf; 419 cudbg_init.outbuf = buf;
419 cudbg_init.outbuf_size = size; 420 cudbg_init.outbuf_size = size;