Skip to content

Commit

Permalink
clocksource/drivers/dw_apb_timer_of: Fix probe failure
Browse files Browse the repository at this point in the history
The driver refuses to probe with -EINVAL since the commit 5d9814d
("clocksource/drivers/dw_apb_timer_of: Add error handling if no clock
available").

Before the driver used to probe successfully if either "clock-freq" or
"clock-frequency" properties has been specified in the device tree.

That commit changed

if (A && B)
	panic("No clock nor clock-frequency property");

into

if (!A && !B)
	return 0;

That's a bug: the reverse of `A && B` is '!A || !B', not '!A && !B'

Signed-off-by: Vadim V. Vlasov <[email protected]>
Signed-off-by: Alexey Sheplyakov <[email protected]>
Fixes: 5d9814d ("clocksource/drivers/dw_apb_timer_of: Add error handling if no clock available").
Cc: Daniel Lezcano <[email protected]>
Cc: Dinh Nguyen <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Vadim V. Vlasov <[email protected]>
Acked-by: Dinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Daniel Lezcano <[email protected]>
  • Loading branch information
asheplyakov authored and dlezcano committed Dec 10, 2021
1 parent 53e87e3 commit a663bd1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/clocksource/dw_apb_timer_of.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static int __init timer_get_base_and_rate(struct device_node *np,
pr_warn("pclk for %pOFn is present, but could not be activated\n",
np);

if (!of_property_read_u32(np, "clock-freq", rate) &&
if (!of_property_read_u32(np, "clock-freq", rate) ||
!of_property_read_u32(np, "clock-frequency", rate))
return 0;

Expand Down

0 comments on commit a663bd1

Please sign in to comment.