Skip to content

Commit

Permalink
drivers: clk: forbid to register a NULL clock pointer
Browse files Browse the repository at this point in the history
Fix clk_register() to return an error on a NULL clock pointer instead
of issuing a segmentation fault.

Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
  • Loading branch information
etienne-lms committed Nov 26, 2023
1 parent 18d7099 commit 9ab62d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/drivers/clk/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void clk_free(struct clk *clk)

static bool __maybe_unused clk_check(struct clk *clk)
{
if (!clk->ops)
if (!clk || !clk->ops)
return false;

if (clk->ops->set_parent && !clk->ops->get_parent)
Expand Down

0 comments on commit 9ab62d3

Please sign in to comment.