On 14/9/21 7:01 pm, Vlastimil Babka wrote:
On 9/2/21 02:01, Imran Khan wrote:
To print a stack entries, users of stackdepot, first
use stack_depot_fetch to get a list of stack entries
and then use stack_trace_print to print this list.
Provide a helper in stackdepot to print stack entries
based on stackdepot handle.
Also change above mentioned users to use this helper.
[...]
+/**
+ * stack_depot_print - print stack entries from a depot
+ *
+ * @handle: Stack depot handle which was returned from
+ * stack_depot_save().
+ *
+ */
+void stack_depot_print(depot_stack_handle_t stack)
+{
+ unsigned long *entries;
+ unsigned int nr_entries;
+
+ nr_entries = stack_depot_fetch(stack, &entries);
Maybe this should also skip stack_trace_print when nr_entries is 0, to avoid
the warning. While the callers added by this patch check handle != 0, future
ones might not.
Agree. I have incorporated this suggestion in latest version [1]
[1]
https://lore.kernel.org/lkml/20210915014806.3206938-1-imran.f.khan@xxxxxxxxxx/
Thanks
-- Imran