Skip to content

Commit

Permalink
clk: fix a panic error caused by accessing NULL pointer
Browse files Browse the repository at this point in the history
In some cases the clock parent would be set NULL when doing re-parent,
it will cause a NULL pointer accessing if clk_set trace event is
enabled.

This patch sets the parent as "none" if the input parameter is NULL.

Fixes: dfc202e (clk: Add tracepoints for hardware operations)
Signed-off-by: Cai Li <cai.li@spreadtrum.com>
Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
  • Loading branch information
Cai Li authored and Stephen Boyd committed Dec 5, 2017
1 parent 588fb54 commit 975b820
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/trace/events/clk.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ DECLARE_EVENT_CLASS(clk_parent,

TP_STRUCT__entry(
__string( name, core->name )
__string( pname, parent->name )
__string( pname, parent ? parent->name : "none" )
),

TP_fast_assign(
__assign_str(name, core->name);
__assign_str(pname, parent->name);
__assign_str(pname, parent ? parent->name : "none");
),

TP_printk("%s %s", __get_str(name), __get_str(pname))
Expand Down

0 comments on commit 975b820

Please sign in to comment.