PM / OPP: Initialize regulator pointer to an error value
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 15 Feb 2016 16:26:42 +0000 (21:56 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 16 Feb 2016 12:12:41 +0000 (13:12 +0100)
commit0c717d0f9cb46259dce5272705adce64a2d646d9
treee2b8424dd7931c98f730720e7062251bdf6b84fd
parentc88c395f4a6485f23f81e385c79945d68bcd5c5d
PM / OPP: Initialize regulator pointer to an error value

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 an error.

This makes code more consistent and more efficient.

Fixes: 7d34d56ef334 (PM / OPP: Disable OPPs that aren't supported by the regulator)
Reported-and-tested-by: Jon Hunter <jonathanh@nvidia.com>
Reported-and-tested-by: Tony Lindgren <tony@atomide.com>
Reported-and-tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
[ rjw: Initialize to -ENXIO ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/opp/core.c