drivers/clocksource/dw_apb_timer_of: fixed probe failure
PATCH 1/1 drivers/clocksource/dw_apb_timer_of: fixed probe failure
The driver refuses to probe with -EINVAL since the commit5d9814df0aec ("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'
--- drivers/clocksource/dw_apb_timer_of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/dw_apb_timer_of.c +1 -1
@@ -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 ;
Signature · 1 line
2.30.2
Quoted 36 lines · Alexey Sheplyakov
The driver refuses to probe with
-EINVALsince the commit5d9814df0aec("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 && Bis '!A || !B', not '!A && !B'Signed-off-by Vadim V. Vlasov <[email protected]>Signed-off-by Alexey Sheplyakov <[email protected]>Fixes 5d9814df0aec56a6 ("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]>--- drivers/clocksource/dw_apb_timer_of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clocksource/dw_apb_timer_of.c +0
-0
drivers/clocksource/dw_apb_timer_of.c static int __init timer_get_base_and_rate(struct device_node *np, · line 53
Quoted 8 lines
drivers/clocksource/dw_apb_timer_of.c +1
-1@@ -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 ;
Daniel Lezcano
AppliedQuoted 19 lines · Alexey Sheplyakov
The driver refuses to probe with
-EINVALsince the commit5d9814df0aec("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 && Bis '!A || !B', not '!A && !B'
Quoted 8 lines
Signed-off-by Vadim V. Vlasov <[email protected]>Signed-off-by Alexey Sheplyakov <[email protected]>Fixes 5d9814df0aec56a6 ("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]>---
Applied, thanks
Quoted 17 lines
drivers/clocksource/dw_apb_timer_of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clocksource/dw_apb_timer_of.c +1
-1@@ -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 ;
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
[tip: timers/urgent] clocksource/drivers/dw_apb_timer_of: Fix probe failure
In reply to Alexey SheplyakovThe following commit has been merged into the timers/urgent branch of tip:
The following commit has been merged into the timers/urgent branch of tip:
Commit-ID: a663bd19114d79f0902e2490fc484e5a7419cdc2 Gitweb: https://git.kernel.org/tip/a663bd19114d79f0902e2490fc484e5a7419cdc2 Author: Alexey Sheplyakov <[email protected]> AuthorDate: Tue, 09 Nov 2021 19:34:02 +04:00 Committer: Daniel Lezcano <[email protected]> CommitterDate: Fri, 10 Dec 2021 17:46:54 +01:00
clocksource/drivers/dw_apb_timer_of: Fix probe failure
The driver refuses to probe with -EINVAL since the commit 5d9814df0aec ("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'
--- drivers/clocksource/dw_apb_timer_of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/dw_apb_timer_of.c +1 -1
@@ -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 ;