[U-Boot] [PATCH v1] clk: clk-uclass: Check ops pointer before use it

Simon Glass sjg at chromium.org
Thu Aug 18 05:45:07 CEST 2016


Hi,

On 17 August 2016 at 09:59, Stephen Warren <swarren at wwwdotorg.org> wrote:
> On 08/17/2016 01:05 AM, Wenyou Yang wrote:
>>
>> Add check ops pointer before use it. Otherwise, it will cause
>> the runtime error for the clk devices without ops callback.
>
>
> Other uclasses like reset, power domain, and mailbox don't do this. All
> drivers must have an ops pointer, or they can't be useful. I'm not sure this
> patch is necessary. Is it just a debugging aid so if the driver writer
> forgets to set the ops pointer the system will error out rather than
> crashing? If so, a post-bind hook in the uclass that refuses the driver if
> it hasn't set the ops pointer would be better.

Yes, we expect drivers to implement these operations. If it is
missing, that is an error. I think assert() would be OK, but we really
don't want to add too many of these sorts of checks.

Regards,
Simon


More information about the U-Boot mailing list