netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] cxgb4: fix build error
@ 2018-01-24  8:01 Rahul Lakkireddy
  2018-01-24  8:01 ` [PATCH net-next 1/2] cxgb4: enable ZLIB_DEFLATE when building cxgb4 Rahul Lakkireddy
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rahul Lakkireddy @ 2018-01-24  8:01 UTC (permalink / raw)
  To: netdev; +Cc: davem, ganeshgr, nirranjan, indranil, Rahul Lakkireddy

Patch 1 fixes build error with compiling cudbg_zlib.c when
CONFIG_ZLIB_DEFLATE macro is not defined.

Patch 2 fixes following sparse warning:
"Using plain integer as NULL pointer"

Thanks,
Rahul

Rahul Lakkireddy (2):
  cxgb4: enable ZLIB_DEFLATE when building cxgb4
  cxgb4: properly initialize variables

 drivers/net/ethernet/chelsio/Kconfig             |  1 +
 drivers/net/ethernet/chelsio/cxgb4/Makefile      |  3 +--
 drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.c  |  3 ++-
 drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.h  | 13 -------------
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c |  3 ++-
 5 files changed, 6 insertions(+), 17 deletions(-)

-- 
2.14.1

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

* [PATCH net-next 1/2] cxgb4: enable ZLIB_DEFLATE when building cxgb4
  2018-01-24  8:01 [PATCH net-next 0/2] cxgb4: fix build error Rahul Lakkireddy
@ 2018-01-24  8:01 ` Rahul Lakkireddy
  2018-01-24  8:01 ` [PATCH net-next 2/2] cxgb4: properly initialize variables Rahul Lakkireddy
  2018-01-24 15:57 ` [PATCH net-next 0/2] cxgb4: fix build error David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Rahul Lakkireddy @ 2018-01-24  8:01 UTC (permalink / raw)
  To: netdev; +Cc: davem, ganeshgr, nirranjan, indranil, Rahul Lakkireddy

Fixes:
drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.c:39:5: error:
redefinition of 'cudbg_compress_buff'
    int cudbg_compress_buff(struct cudbg_init *pdbg_init,
        ^~~~~~~~~~~~~~~~~~~
   In file included from
drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.c:23:0:
   drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.h:45:19: note: previous
definition of 'cudbg_compress_buff' was here
    static inline int cudbg_compress_buff(struct cudbg_init *pdbg_init,
                      ^~~~~~~~~~~~~~~~~~~

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>
---
 drivers/net/ethernet/chelsio/Kconfig            |  1 +
 drivers/net/ethernet/chelsio/cxgb4/Makefile     |  3 +--
 drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.h | 13 -------------
 3 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/Kconfig b/drivers/net/ethernet/chelsio/Kconfig
index 5713e83be08c..e2cdfa75673f 100644
--- a/drivers/net/ethernet/chelsio/Kconfig
+++ b/drivers/net/ethernet/chelsio/Kconfig
@@ -69,6 +69,7 @@ config CHELSIO_T4
 	depends on PCI && (IPV6 || IPV6=n)
 	select FW_LOADER
 	select MDIO
+	select ZLIB_DEFLATE
 	---help---
 	  This driver supports Chelsio T4, T5 & T6 based gigabit, 10Gb Ethernet
 	  adapter and T5/T6 based 40Gb and T6 based 25Gb, 50Gb and 100Gb
diff --git a/drivers/net/ethernet/chelsio/cxgb4/Makefile b/drivers/net/ethernet/chelsio/cxgb4/Makefile
index 5df923798669..53b6a02c778e 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/Makefile
+++ b/drivers/net/ethernet/chelsio/cxgb4/Makefile
@@ -8,8 +8,7 @@ obj-$(CONFIG_CHELSIO_T4) += cxgb4.o
 cxgb4-objs := cxgb4_main.o l2t.o smt.o t4_hw.o sge.o clip_tbl.o cxgb4_ethtool.o \
 	      cxgb4_uld.o sched.o cxgb4_filter.o cxgb4_tc_u32.o \
 	      cxgb4_ptp.o cxgb4_tc_flower.o cxgb4_cudbg.o \
-	      cudbg_common.o cudbg_lib.o
+	      cudbg_common.o cudbg_lib.o cudbg_zlib.o
 cxgb4-$(CONFIG_CHELSIO_T4_DCB) +=  cxgb4_dcb.o
 cxgb4-$(CONFIG_CHELSIO_T4_FCOE) +=  cxgb4_fcoe.o
 cxgb4-$(CONFIG_DEBUG_FS) += cxgb4_debugfs.o
-cxgb4-$(CONFIG_ZLIB_DEFLATE) += cudbg_zlib.o
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.h b/drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.h
index 9d55c4c38c84..60d23805dfc3 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.h
@@ -33,24 +33,11 @@ struct cudbg_compress_hdr {
 
 static inline int cudbg_get_workspace_size(void)
 {
-#ifdef CONFIG_ZLIB_DEFLATE
 	return zlib_deflate_workspacesize(CUDBG_ZLIB_WIN_BITS,
 					  CUDBG_ZLIB_MEM_LVL);
-#else
-	return 0;
-#endif /* CONFIG_ZLIB_DEFLATE */
 }
 
-#ifndef CONFIG_ZLIB_DEFLATE
-static inline int cudbg_compress_buff(struct cudbg_init *pdbg_init,
-				      struct cudbg_buffer *pin_buff,
-				      struct cudbg_buffer *pout_buff)
-{
-	return 0;
-}
-#else
 int cudbg_compress_buff(struct cudbg_init *pdbg_init,
 			struct cudbg_buffer *pin_buff,
 			struct cudbg_buffer *pout_buff);
-#endif /* CONFIG_ZLIB_DEFLATE */
 #endif /* __CUDBG_ZLIB_H__ */
-- 
2.14.1

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

* [PATCH net-next 2/2] cxgb4: properly initialize variables
  2018-01-24  8:01 [PATCH net-next 0/2] cxgb4: fix build error Rahul Lakkireddy
  2018-01-24  8:01 ` [PATCH net-next 1/2] cxgb4: enable ZLIB_DEFLATE when building cxgb4 Rahul Lakkireddy
@ 2018-01-24  8:01 ` Rahul Lakkireddy
  2018-01-24 15:57 ` [PATCH net-next 0/2] cxgb4: fix build error David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Rahul Lakkireddy @ 2018-01-24  8:01 UTC (permalink / raw)
  To: netdev; +Cc: davem, ganeshgr, nirranjan, indranil, Rahul Lakkireddy

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>
---
 drivers/net/ethernet/chelsio/cxgb4/cudbg_zlib.c  | 3 ++-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c | 3 ++-
 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,
 			struct cudbg_buffer *pin_buff,
 			struct cudbg_buffer *pout_buff)
 {
-	struct z_stream_s compress_stream = { 0 };
 	struct cudbg_buffer temp_buff = { 0 };
+	struct z_stream_s compress_stream;
 	struct cudbg_compress_hdr *c_hdr;
 	int rc;
 
@@ -53,6 +53,7 @@ int cudbg_compress_buff(struct cudbg_init *pdbg_init,
 	c_hdr = (struct cudbg_compress_hdr *)temp_buff.data;
 	c_hdr->compress_id = CUDBG_ZLIB_COMPRESS_ID;
 
+	memset(&compress_stream, 0, sizeof(struct z_stream_s));
 	compress_stream.workspace = pdbg_init->workspace;
 	rc = zlib_deflateInit2(&compress_stream, Z_DEFAULT_COMPRESSION,
 			       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)
 int cxgb4_cudbg_collect(struct adapter *adap, void *buf, u32 *buf_size,
 			u32 flag)
 {
-	struct cudbg_init cudbg_init = { 0 };
 	struct cudbg_buffer dbg_buff = { 0 };
 	u32 size, min_size, total_size = 0;
+	struct cudbg_init cudbg_init;
 	struct cudbg_hdr *cudbg_hdr;
 	int rc;
 
 	size = *buf_size;
 
+	memset(&cudbg_init, 0, sizeof(struct cudbg_init));
 	cudbg_init.adap = adap;
 	cudbg_init.outbuf = buf;
 	cudbg_init.outbuf_size = size;
-- 
2.14.1

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

* Re: [PATCH net-next 0/2] cxgb4: fix build error
  2018-01-24  8:01 [PATCH net-next 0/2] cxgb4: fix build error Rahul Lakkireddy
  2018-01-24  8:01 ` [PATCH net-next 1/2] cxgb4: enable ZLIB_DEFLATE when building cxgb4 Rahul Lakkireddy
  2018-01-24  8:01 ` [PATCH net-next 2/2] cxgb4: properly initialize variables Rahul Lakkireddy
@ 2018-01-24 15:57 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-01-24 15:57 UTC (permalink / raw)
  To: rahul.lakkireddy; +Cc: netdev, ganeshgr, nirranjan, indranil

From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Date: Wed, 24 Jan 2018 13:31:03 +0530

> Patch 1 fixes build error with compiling cudbg_zlib.c when
> CONFIG_ZLIB_DEFLATE macro is not defined.
> 
> Patch 2 fixes following sparse warning:
> "Using plain integer as NULL pointer"

Series applied, thanks Rahul.

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

end of thread, other threads:[~2018-01-24 15:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-24  8:01 [PATCH net-next 0/2] cxgb4: fix build error Rahul Lakkireddy
2018-01-24  8:01 ` [PATCH net-next 1/2] cxgb4: enable ZLIB_DEFLATE when building cxgb4 Rahul Lakkireddy
2018-01-24  8:01 ` [PATCH net-next 2/2] cxgb4: properly initialize variables Rahul Lakkireddy
2018-01-24 15:57 ` [PATCH net-next 0/2] cxgb4: fix build error David Miller

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).