[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b6ac9148-81cf-a1e7-3c18-c9ff9ca3694e@kernel.org>
Date: Mon, 6 Dec 2021 09:25:45 -0600
From: Dinh Nguyen <dinguyen@...nel.org>
To: Alexey Sheplyakov <asheplyakov@...ealt.ru>,
linux-kernel@...r.kernel.org
Cc: "Vadim V . Vlasov" <vadim.vlasov@...itech.ru>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] drivers/clocksource/dw_apb_timer_of: fixed probe failure
On 11/9/21 9:34 AM, Alexey Sheplyakov wrote:
> 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'
>
> Signed-off-by: Vadim V. Vlasov <vadim.vlasov@...itech.ru>
> Signed-off-by: Alexey Sheplyakov <asheplyakov@...ealt.ru>
> Fixes: 5d9814df0aec56a6 ("clocksource/drivers/dw_apb_timer_of: Add error handling if no clock available").
> Cc: Daniel Lezcano <daniel.lezcano@...aro.org>
> Cc: Dinh Nguyen <dinguyen@...nel.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Vadim V. Vlasov <vadim.vlasov@...itech.ru>
> ---
> drivers/clocksource/dw_apb_timer_of.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
> index 3819ef5b7098..3245eb0c602d 100644
> --- a/drivers/clocksource/dw_apb_timer_of.c
> +++ b/drivers/clocksource/dw_apb_timer_of.c
> @@ -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;
>
>
Acked-by: Dinh Nguyen <dinguyen@...nel.org>
Powered by blists - more mailing lists