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

2016-02-16 Thread Mark Brown
On Tue, Feb 16, 2016 at 04:12:39PM +0100, Arnd Bergmann wrote: > On Tuesday 16 February 2016 13:11:08 Mark Brown wrote: > > No, we always return an error pointer if we fail to get a regulator. > > The difference with optional regulators is in how we handle the > > situation where we have full cons

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

2016-02-16 Thread Arnd Bergmann
On Tuesday 16 February 2016 13:11:08 Mark Brown wrote: > On Tue, Feb 16, 2016 at 10:10:44AM +0100, Arnd Bergmann wrote: > > On Tuesday 16 February 2016 01:56:16 Mark Brown wrote: > > > > No, NULL is explicitly not something you can substitute in, > > > essentially all the users are just not bother

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

2016-02-16 Thread Mark Brown
On Tue, Feb 16, 2016 at 10:10:44AM +0100, Arnd Bergmann wrote: > On Tuesday 16 February 2016 01:56:16 Mark Brown wrote: > > 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 encourag

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

2016-02-16 Thread Arnd Bergmann
On Tuesday 16 February 2016 01:56:16 Mark Brown wrote: > 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 c

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

2016-02-15 Thread Mark Brown
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 AP

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

2016-02-15 Thread Viresh Kumar
Cc'ing Mark as well. On 15-02-16, 21:38, Arnd Bergmann wrote: > There is usually something else wrong if you have to check for both. > Why exactly do you need to check for both IS_ERR and NULL? And here is the reasoning behind it: - It is normally said that 'NULL' is a valid clk. The same is ap

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

2016-02-15 Thread Rafael J. Wysocki
On Tuesday, February 16, 2016 06:17:16 AM Viresh Kumar wrote: > On 15-02-16, 22:13, Rafael J. Wysocki wrote: > > That should be something like -ENXIO IMO. > > Thanks for modifying and applying the patch :) Well, you're welcome. I wanted it to be fixed in the tomorrow's linux-next so people can b

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

2016-02-15 Thread Viresh Kumar
On 15-02-16, 22:13, Rafael J. Wysocki wrote: > That should be something like -ENXIO IMO. Thanks for modifying and applying the patch :) -- viresh

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

2016-02-15 Thread Rafael J. Wysocki
On Mon, Feb 15, 2016 at 9:38 PM, Arnd Bergmann wrote: > On Monday 15 February 2016 21:56:42 Viresh Kumar wrote: >> We are currently required to do two checks for regulator pointer: >> IS_ERR() and IS_NULL(). >> >> And multiple instances are reported, about both of these not being used >> consisten

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

2016-02-15 Thread Arnd Bergmann
On Monday 15 February 2016 21:56:42 Viresh Kumar wrote: > We are currently required to do two checks for regulator pointer: > IS_ERR() and IS_NULL(). > > And multiple instances are reported, about both of these not being used > consistently and so resulting in crashes. > > Fix that by initializin

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

2016-02-15 Thread Viresh Kumar
On 15-02-16, 16:42, Jon Hunter wrote: > > On 15/02/16 16:26, Viresh Kumar wrote: > > We are currently required to do two checks for regulator pointer: > > IS_ERR() and IS_NULL(). > > > > And multiple instances are reported, about both of these not being used > > consistently and so resulting in c

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

2016-02-15 Thread Jon Hunter
On 15/02/16 16:26, Viresh Kumar wrote: > We are currently required to do two checks for regulator pointer: > IS_ERR() and IS_NULL(). > > And multiple instances are reported, about both of these not being used > consistently and so resulting in crashes. > > Fix that by initializing regulator poin

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

2016-02-15 Thread Viresh Kumar
We are currently required to do two checks for regulator pointer: IS_ERR() and IS_NULL(). And multiple instances are reported, about both of these not being used consistently and so resulting in crashes. Fix that by initializing regulator pointer with an error value and checking it only against a