[PATCH] clk: fix clk_get_rate() documentation

Giulio Benetti giulio.benetti at benettiengineering.com
Sat Feb 13 02:17:45 CET 2021


On 2/13/21 12:25 AM, Sean Anderson wrote:
> On 2/10/21 12:37 PM, Giulio Benetti wrote:
>> clk_get_rate() can't and doesn't return -ve on error, it actually returns 0
>> on error or a value greater than 0 on success. So let's fix its
>> documentation.
>>
>> Signed-off-by: Giulio Benetti <giulio.benetti at benettiengineering.com>
>> ---
>>    include/clk.h | 2 +-
>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/clk.h b/include/clk.h
>> index ca6b85fa6f..a833d6a27b 100644
>> --- a/include/clk.h
>> +++ b/include/clk.h
>> @@ -344,7 +344,7 @@ int clk_free(struct clk *clk);
>>     *
>>     * @clk:	A clock struct that was previously successfully requested by
>>     *		clk_request/get_by_*().
>> - * @return clock rate in Hz, or -ve error code.
>> + * @return clock rate in Hz on success, or 0 on error.
>>     */
>>    ulong clk_get_rate(struct clk *clk);
>>    
>>
> 
> NAK. This function *does* return negative errors (see e.g.
> drivers/clk/clk-uclass.c). However, it may return 0 if passed an invalid
> clock (see clk_valid).

Oops, I didn't dig enough, sorry. It must pass negative value to signal 
if get_rate() pointer.

Best regards
-- 
Giulio Benetti
Benetti Engineering sas


More information about the U-Boot mailing list