lkml.org 
[lkml]   [2021]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] clk: <linux/clk.h>: correct clk_get_parent() documentation
From
Date
On 4/27/21 2:38 AM, Russell King - ARM Linux admin wrote:
> On Mon, Apr 26, 2021 at 08:13:42PM -0700, Randy Dunlap wrote:
>> Make the kernel-doc return value agree with both the stub implementation
>> in <linux/clk.h> and the non-stub function in drivers/clk/clk.c.
>>
>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
>> Cc: Russell King <linux@armlinux.org.uk>
>> Cc: linux-clk@vger.kernel.org
>> ---
>> There are several drivers that call clk_get_parent() and use its
>> return value as though it returns an ERR_PTR(). I am working on a
>> patch series to fix those.
>
> The whole premise of the CLK API is that:
>
> - clk values that IS_ERR() returns true are errors
> - clk values that IS_ERR() returns false are valid
>
> and that is that - nice, simple, easy to understand. So the
> documentation is correct. If clk_get_parent() needs to return an
> error, it does so by returning an error-pointer, not by returning
> NULL.

Hm, so the 6 drivers that do this are OK then, if
clk_get_parent() returns NULL?


parent = clk_get_parent(clk);
if (IS_ERR(parent)) {
dev_err(cpu_dev, "Cannot get parent clock for CPU0\n");
clk_put(clk);
return PTR_ERR(parent);
}

/* Get parent CPU frequency */
base_frequency = clk_get_rate(parent);

boom?

--
~Randy

\
 
 \ /
  Last update: 2021-04-27 19:08    [W:0.110 / U:25.900 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site