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

From: Mark Brown
Date: Mon Feb 15 2016 - 20:56:46 EST


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: signature.asc
Description: PGP signature