Search Linux Wireless

Re: [PATCH] rt2x00: call clk_get_rate only if we have a clock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 8 July 2017 at 09:27, Mathias Kresin <dev@xxxxxxxxx> wrote:
> If clk_get returns an error, rt2x00dev->clk is set to NULL. In
> contrast to the common clock framework provided clk_get_rate(), at
> least the ramips and bcm63xx legacy implementation of the clk API
> access the rate member of the clk struct without a NULL check. This
> results into a kernel panic if we do not have a (SoC) clock.
>
> Call clk_get_rate only if we have a clock to fix the issues. This
> approach is similar to what is done in the kernel at various places.
> Usually clk_get_rate() is only called if clk_get_rate() doesn't return

Did you mean clk_get() as the second one?

> an error.
>
> Signed-off-by: Mathias Kresin <dev@xxxxxxxxx>

Tbh, I'd rather have this fixed at the source than adding a workaround
to consumers, to have a consistent API across implementations (with
drivers/clk/clk.c as the reference).

And there don't seem that many, at least searching for clk_get_rate
gave me only two handful of implementations of which many already
check for NULL.


Regards
Jonas



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux