Skip to content

Commit

Permalink
drivers: clk: avoid the assert failure when there's "assigned-clocks"
Browse files Browse the repository at this point in the history
Once "assigned-clocks" is parsed correctly variable "clk" will
retain the non-NULL value and skip "return", when "res" is
non-zero for new "clock_idx" assert(false) will happen.

Signed-off-by: Tony Han <tony.han@microchip.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
  • Loading branch information
TonyHan11 authored and jforissier committed Sep 11, 2023
1 parent 7be18e1 commit 6c4cb22
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/drivers/clk/clk_dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ static void parse_assigned_clock(const void *fdt, int nodeoffset)
unsigned long rate = 0;
struct clk *parent = NULL;
const uint32_t *rate_prop = NULL;
TEE_Result __maybe_unused res = TEE_ERROR_GENERIC;
TEE_Result res = TEE_ERROR_GENERIC;

rate_prop = fdt_getprop(fdt, nodeoffset, "assigned-clock-rates",
&rate_len);
Expand All @@ -157,9 +157,9 @@ static void parse_assigned_clock(const void *fdt, int nodeoffset)
while (true) {
res = clk_dt_get_by_idx_prop("assigned-clocks", fdt, nodeoffset,
clock_idx, &clk);
if (!clk)
if (res)
return;
assert(!res);
assert(clk);

res = clk_dt_get_by_idx_prop("assigned-clock-parents", fdt,
nodeoffset, clock_idx, &parent);
Expand Down

0 comments on commit 6c4cb22

Please sign in to comment.