Re: [PATCH] PM / OPP: Initialize regulator pointer to an error value

Mark Brown
2016-02-16T01:56:42Z

[-- Attachment #1: Type: text/plain, Size: 772 bytes --]

On Tue, Feb 16, 2016 at 06:30:59AM +0530, Viresh Kumar wrote:

> - And so I left the regulator pointer to NULL in OPP core.
> - But then I realized that its not safe to call many regulator core
> APIs with NULL regulator, as those caused the crashes reported by
> multiple people now.
> - clk APIs guarantee that they return early when NULL clk is passed to
> them.
> - Do we need to do the same for regulator core as well ?

No, NULL is explicitly not something you can substitute in,
essentially all the users are just not bothering to implement error
checking and we don't want to encourage that. The set of use cases
where we legitimately have optional supplies is very small, much smaller
than clocks, because it makes the electrical engineering a lot harder.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]