Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1456949

Re: [PATCH] clk: prevent __of_clk_get_hw_from_provider() from returning NULL

From Sylwester Nawrocki <s.nawrocki@samsung.com>
Newsgroups linux.kernel
Subject Re: [PATCH] clk: prevent __of_clk_get_hw_from_provider() from returning NULL
Date 2016-08-05 10:40 +0200
Message-ID <s2IPD-561-7@gated-at.bofh.it> (permalink)
References <rWzcl-27O-17@gated-at.bofh.it> <s2xUd-6f1-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 08/04/2016 10:57 PM, Stephen Boyd wrote:
> On 07/19, Masahiro Yamada wrote:
>> > The .get(_hw) callback of an OF clock provider can return a NULL
>> > pointer in some cases.
>> > 
>> > For example, of_clk_src_onecell_get() returns NULL for index 1 of a
>> > sparse array of clocks like follows:
>> > 
>> >   clk_num == 3
>> >   idx 0: UART clk
>> >   idx 1: NULL (no clk is allocated)
>> >   idx 2: I2C clk
>> > 
>> > In such cases, clk_get() successfully returns NULL.

I remember running into same issue before, we have addressed
it by initializing the array of clocks with some errno value,
e.g ERR_PTR(-ENOENT), so there is no chance to get NULL from
the array - either a valid clk pointer or an ERR_PTR() value.

--
Thanks,
Sylwester

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] clk: prevent __of_clk_get_hw_from_provider() from  returning NULL Stephen Boyd <sboyd@codeaurora.org> - 2016-08-04 23:00 +0200
  Re: [PATCH] clk: prevent __of_clk_get_hw_from_provider() from  returning NULL Sylwester Nawrocki <s.nawrocki@samsung.com> - 2016-08-05 10:40 +0200
  Re: [PATCH] clk: prevent __of_clk_get_hw_from_provider() from  returning NULL Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-08-07 19:10 +0200
  Re: [PATCH] clk: prevent __of_clk_get_hw_from_provider() from  returning NULL Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-08-10 20:10 +0200

csiph-web