lkml.org 
[lkml]   [2018]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] debugobjects: avoid another unused variable warning.
From
Date


On 3/13/18 6:18 AM, Arnd Bergmann wrote:
> debug_objects_maxchecked is only updated in __debug_check_no_obj_freed(),
> and only read in debug_objects_maxchecked, unfortunately both of
> these are optional and depend on different Kconfig symbols. When both
> CONFIG_DEBUG_OBJECTS_FREE and CONFIG_DEBUG_FS are disabled, we get
> this warning:
>
> lib/debugobjects.c:56:14: error: 'debug_objects_maxchecked' defined but not used [-Werror=unused-variable]
>
> Rather than trying to add more complex #ifdef protections, this marks
> the variable as __maybe_unused so it can be silently dropped when
> usused.

Thanks for catching this.

Acked-by: Yang Shi <yang.shi@linux.alibaba.com>

>
> Fixes: bd9dcd046509 ("debugobjects: Export max loops counter")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> lib/debugobjects.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/debugobjects.c b/lib/debugobjects.c
> index 105ecfc47d8c..994be4805cec 100644
> --- a/lib/debugobjects.c
> +++ b/lib/debugobjects.c
> @@ -53,7 +53,7 @@ static int obj_nr_tofree;
> static struct kmem_cache *obj_cache;
>
> static int debug_objects_maxchain __read_mostly;
> -static int debug_objects_maxchecked __read_mostly;
> +static int __maybe_unused debug_objects_maxchecked __read_mostly;
> static int debug_objects_fixups __read_mostly;
> static int debug_objects_warnings __read_mostly;
> static int debug_objects_enabled __read_mostly

\
 
 \ /
  Last update: 2018-03-13 19:30    [W:0.063 / U:4.664 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site