mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lockdep: Include print_collision and helper functions in DEBUG_LOCKDEP
@ 2016-04-14  0:57 Yang Shi
  2016-04-15 17:06 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Shi @ 2016-04-14  0:57 UTC (permalink / raw)
  To: peterz, mingo; +Cc: arnd, linux-kernel, linaro-kernel, yang.shi

pint_collosion and helper functions are just used when DEBUG_LOCKDEP is
selected, so include them in #ifdef CONFIG_DEBUG_LOCKDEP to avoid the below
"defined but not used" warning when DEBUG_LOCKDEP is off:

kernel/locking/lockdep.c:2051:13: warning: 'print_collision' defined but not used [-Wunused-function]
 static void print_collision(struct task_struct *curr,

Signed-off-by: Yang Shi <yang.shi@linaro.org>
---
 kernel/locking/lockdep.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 2324ba5..ed94109 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -1999,6 +1999,7 @@ static inline int get_first_held_lock(struct task_struct *curr,
 	return ++i;
 }
 
+#ifdef CONFIG_DEBUG_LOCKDEP
 /*
  * Returns the next chain_key iteration
  */
@@ -2069,6 +2070,7 @@ static void print_collision(struct task_struct *curr,
 	printk("\nstack backtrace:\n");
 	dump_stack();
 }
+#endif
 
 /*
  * Checks whether the chain and the current held locks are consistent
-- 
2.0.2

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

* Re: [PATCH] lockdep: Include print_collision and helper functions in DEBUG_LOCKDEP
  2016-04-14  0:57 [PATCH] lockdep: Include print_collision and helper functions in DEBUG_LOCKDEP Yang Shi
@ 2016-04-15 17:06 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2016-04-15 17:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Yang Shi, Peter Zijlstra, Arnd Bergmann, LKML, linaro-kernel,
	Alfredo Alvarez Fernandez

On Wed, Apr 13, 2016 at 5:57 PM, Yang Shi <yang.shi@linaro.org> wrote:
> pint_collosion and helper functions are just used when DEBUG_LOCKDEP is
> selected, so include them in #ifdef CONFIG_DEBUG_LOCKDEP to avoid the below
> "defined but not used" warning when DEBUG_LOCKDEP is off:
>
> kernel/locking/lockdep.c:2051:13: warning: 'print_collision' defined but not used [-Wunused-function]
>  static void print_collision(struct task_struct *curr,
>
> Signed-off-by: Yang Shi <yang.shi@linaro.org>

Thanks, I had noticed this warning too.

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  kernel/locking/lockdep.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 2324ba5..ed94109 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -1999,6 +1999,7 @@ static inline int get_first_held_lock(struct task_struct *curr,
>         return ++i;
>  }
>
> +#ifdef CONFIG_DEBUG_LOCKDEP
>  /*
>   * Returns the next chain_key iteration
>   */
> @@ -2069,6 +2070,7 @@ static void print_collision(struct task_struct *curr,
>         printk("\nstack backtrace:\n");
>         dump_stack();
>  }
> +#endif
>
>  /*
>   * Checks whether the chain and the current held locks are consistent
> --
> 2.0.2
>



-- 
Kees Cook
Chrome OS & Brillo Security

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

end of thread, other threads:[~2016-04-15 17:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-14  0:57 [PATCH] lockdep: Include print_collision and helper functions in DEBUG_LOCKDEP Yang Shi
2016-04-15 17:06 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®