Skip to content

Commit

Permalink
drivers: microchip_pit: fix the length used for comparing the clock n…
Browse files Browse the repository at this point in the history
…ames

sizeof("syspll") equals to 7 with a character '\0' in count, adjust the
length used for the comparison to obtain the expected result.
Move the test of "parent" into the while loop to improve debug convenience.

Fixes: 8796ab4 ("drivers: microchip_pit: add driver for sama7g54's pit64b")
Signed-off-by: Tony Han <[email protected]>
Acked-by: Etienne Carriere <[email protected]>
  • Loading branch information
TonyHan11 authored and jforissier committed Jan 9, 2025
1 parent c1a7c89 commit 9145b71
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions core/drivers/microchip_pit.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ static TEE_Result microchip_pit_probe(const void *fdt, int node,
if (res)
panic();

do {
while (1) {
parent = clk_get_parent_by_index(gclk, i++);
if (!memcmp("syspll", clk_get_name(parent), sizeof("syspll")))
if (!parent)
panic();
if (!memcmp("syspll", clk_get_name(parent),
sizeof("syspll") - 1))
break;
} while (parent);
if (!parent)
panic();
}

res = clk_set_parent(gclk, parent);
if (res)
Expand Down

0 comments on commit 9145b71

Please sign in to comment.