linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drivers: staging: zcache: fix compile error
@ 2013-04-02  2:47 Bob Liu
  2013-04-02  2:47 ` [PATCH 2/2] drivers: staging: zcache: fix compile warning Bob Liu
  2013-04-02 14:18 ` [PATCH 1/2] drivers: staging: zcache: fix compile error Konrad Rzeszutek Wilk
  0 siblings, 2 replies; 4+ messages in thread
From: Bob Liu @ 2013-04-02  2:47 UTC (permalink / raw)
  To: gregkh; +Cc: konrad.wilk, dan.magenheimer, fengguang.wu, linux-mm, akpm,
	Bob Liu

Because 'ramster_debugfs_init' is not defined if !CONFIG_DEBUG_FS, there is
compile error:

$ make drivers/staging/zcache/
staging/zcache/ramster/ramster.c: In function a??ramster_inita??:
staging/zcache/ramster/ramster.c:981:2: error: implicit declaration of
function a??ramster_debugfs_inita?? [-Werror=implicit-function-declaration]

This patch fix it and reduce some #ifdef CONFIG_DEBUG_FS in .c files the same
way.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
 drivers/staging/zcache/ramster/ramster.c |    5 +++++
 drivers/staging/zcache/zbud.c            |    7 +++++--
 drivers/staging/zcache/zcache-main.c     |    2 --
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/zcache/ramster/ramster.c b/drivers/staging/zcache/ramster/ramster.c
index 4f715c7..5617590 100644
--- a/drivers/staging/zcache/ramster/ramster.c
+++ b/drivers/staging/zcache/ramster/ramster.c
@@ -134,6 +134,11 @@ static int ramster_debugfs_init(void)
 }
 #undef	zdebugfs
 #undef	zdfs64
+#else
+static inline int ramster_debugfs_init(void)
+{
+	return 0;
+}
 #endif
 
 static LIST_HEAD(ramster_rem_op_list);
diff --git a/drivers/staging/zcache/zbud.c b/drivers/staging/zcache/zbud.c
index fdff5c6..6cda4ed 100644
--- a/drivers/staging/zcache/zbud.c
+++ b/drivers/staging/zcache/zbud.c
@@ -342,6 +342,11 @@ static int zbud_debugfs_init(void)
 }
 #undef	zdfs
 #undef	zdfs64
+#else
+static inline int zbud_debugfs_init(void)
+{
+	return 0;
+}
 #endif
 
 /* protects the buddied list and all unbuddied lists */
@@ -1051,9 +1056,7 @@ void zbud_init(void)
 {
 	int i;
 
-#ifdef CONFIG_DEBUG_FS
 	zbud_debugfs_init();
-#endif
 	BUG_ON((sizeof(struct tmem_handle) * 2 > CHUNK_SIZE));
 	BUG_ON(sizeof(struct zbudpage) > sizeof(struct page));
 	for (i = 0; i < NCHUNKS; i++) {
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 4e52a94..ac75670 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -1753,9 +1753,7 @@ static int zcache_init(void)
 		namestr = "ramster";
 		ramster_register_pamops(&zcache_pamops);
 	}
-#ifdef CONFIG_DEBUG_FS
 	zcache_debugfs_init();
-#endif
 	if (zcache_enabled) {
 		unsigned int cpu;
 
-- 
1.7.10.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH 2/2] drivers: staging: zcache: fix compile warning
  2013-04-02  2:47 [PATCH 1/2] drivers: staging: zcache: fix compile error Bob Liu
@ 2013-04-02  2:47 ` Bob Liu
  2013-04-02 14:18   ` Konrad Rzeszutek Wilk
  2013-04-02 14:18 ` [PATCH 1/2] drivers: staging: zcache: fix compile error Konrad Rzeszutek Wilk
  1 sibling, 1 reply; 4+ messages in thread
From: Bob Liu @ 2013-04-02  2:47 UTC (permalink / raw)
  To: gregkh; +Cc: konrad.wilk, dan.magenheimer, fengguang.wu, linux-mm, akpm,
	Bob Liu

Fix below compile warning:
staging/zcache/zcache-main.c: In function a??zcache_autocreate_poola??:
staging/zcache/zcache-main.c:1393:13: warning: a??clia?? may be used uninitialized
in this function [-Wuninitialized]

Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
 drivers/staging/zcache/zcache-main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index ac75670..7999021 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -1341,7 +1341,7 @@ static int zcache_local_new_pool(uint32_t flags)
 int zcache_autocreate_pool(unsigned int cli_id, unsigned int pool_id, bool eph)
 {
 	struct tmem_pool *pool;
-	struct zcache_client *cli;
+	struct zcache_client *cli = NULL;
 	uint32_t flags = eph ? 0 : TMEM_POOL_PERSIST;
 	int ret = -1;
 
-- 
1.7.10.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 1/2] drivers: staging: zcache: fix compile error
  2013-04-02  2:47 [PATCH 1/2] drivers: staging: zcache: fix compile error Bob Liu
  2013-04-02  2:47 ` [PATCH 2/2] drivers: staging: zcache: fix compile warning Bob Liu
@ 2013-04-02 14:18 ` Konrad Rzeszutek Wilk
  1 sibling, 0 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-04-02 14:18 UTC (permalink / raw)
  To: Bob Liu; +Cc: gregkh, dan.magenheimer, fengguang.wu, linux-mm, akpm, Bob Liu

On Tue, Apr 02, 2013 at 10:47:42AM +0800, Bob Liu wrote:
> Because 'ramster_debugfs_init' is not defined if !CONFIG_DEBUG_FS, there is
> compile error:
> 
> $ make drivers/staging/zcache/
> staging/zcache/ramster/ramster.c: In function ‘ramster_init’:
> staging/zcache/ramster/ramster.c:981:2: error: implicit declaration of
> function ‘ramster_debugfs_init’ [-Werror=implicit-function-declaration]
> 
> This patch fix it and reduce some #ifdef CONFIG_DEBUG_FS in .c files the same
> way.
> 
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Bob Liu <bob.liu@oracle.com>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  drivers/staging/zcache/ramster/ramster.c |    5 +++++
>  drivers/staging/zcache/zbud.c            |    7 +++++--
>  drivers/staging/zcache/zcache-main.c     |    2 --
>  3 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/zcache/ramster/ramster.c b/drivers/staging/zcache/ramster/ramster.c
> index 4f715c7..5617590 100644
> --- a/drivers/staging/zcache/ramster/ramster.c
> +++ b/drivers/staging/zcache/ramster/ramster.c
> @@ -134,6 +134,11 @@ static int ramster_debugfs_init(void)
>  }
>  #undef	zdebugfs
>  #undef	zdfs64
> +#else
> +static inline int ramster_debugfs_init(void)
> +{
> +	return 0;
> +}
>  #endif
>  
>  static LIST_HEAD(ramster_rem_op_list);
> diff --git a/drivers/staging/zcache/zbud.c b/drivers/staging/zcache/zbud.c
> index fdff5c6..6cda4ed 100644
> --- a/drivers/staging/zcache/zbud.c
> +++ b/drivers/staging/zcache/zbud.c
> @@ -342,6 +342,11 @@ static int zbud_debugfs_init(void)
>  }
>  #undef	zdfs
>  #undef	zdfs64
> +#else
> +static inline int zbud_debugfs_init(void)
> +{
> +	return 0;
> +}
>  #endif
>  
>  /* protects the buddied list and all unbuddied lists */
> @@ -1051,9 +1056,7 @@ void zbud_init(void)
>  {
>  	int i;
>  
> -#ifdef CONFIG_DEBUG_FS
>  	zbud_debugfs_init();
> -#endif
>  	BUG_ON((sizeof(struct tmem_handle) * 2 > CHUNK_SIZE));
>  	BUG_ON(sizeof(struct zbudpage) > sizeof(struct page));
>  	for (i = 0; i < NCHUNKS; i++) {
> diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
> index 4e52a94..ac75670 100644
> --- a/drivers/staging/zcache/zcache-main.c
> +++ b/drivers/staging/zcache/zcache-main.c
> @@ -1753,9 +1753,7 @@ static int zcache_init(void)
>  		namestr = "ramster";
>  		ramster_register_pamops(&zcache_pamops);
>  	}
> -#ifdef CONFIG_DEBUG_FS
>  	zcache_debugfs_init();
> -#endif
>  	if (zcache_enabled) {
>  		unsigned int cpu;
>  
> -- 
> 1.7.10.4
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 2/2] drivers: staging: zcache: fix compile warning
  2013-04-02  2:47 ` [PATCH 2/2] drivers: staging: zcache: fix compile warning Bob Liu
@ 2013-04-02 14:18   ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-04-02 14:18 UTC (permalink / raw)
  To: Bob Liu; +Cc: gregkh, dan.magenheimer, fengguang.wu, linux-mm, akpm, Bob Liu

On Tue, Apr 02, 2013 at 10:47:43AM +0800, Bob Liu wrote:
> Fix below compile warning:
> staging/zcache/zcache-main.c: In function ‘zcache_autocreate_pool’:
> staging/zcache/zcache-main.c:1393:13: warning: ‘cli’ may be used uninitialized
> in this function [-Wuninitialized]
> 
> Signed-off-by: Bob Liu <bob.liu@oracle.com>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  drivers/staging/zcache/zcache-main.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
> index ac75670..7999021 100644
> --- a/drivers/staging/zcache/zcache-main.c
> +++ b/drivers/staging/zcache/zcache-main.c
> @@ -1341,7 +1341,7 @@ static int zcache_local_new_pool(uint32_t flags)
>  int zcache_autocreate_pool(unsigned int cli_id, unsigned int pool_id, bool eph)
>  {
>  	struct tmem_pool *pool;
> -	struct zcache_client *cli;
> +	struct zcache_client *cli = NULL;
>  	uint32_t flags = eph ? 0 : TMEM_POOL_PERSIST;
>  	int ret = -1;
>  
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2013-04-02 14:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-02  2:47 [PATCH 1/2] drivers: staging: zcache: fix compile error Bob Liu
2013-04-02  2:47 ` [PATCH 2/2] drivers: staging: zcache: fix compile warning Bob Liu
2013-04-02 14:18   ` Konrad Rzeszutek Wilk
2013-04-02 14:18 ` [PATCH 1/2] drivers: staging: zcache: fix compile error Konrad Rzeszutek Wilk

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