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)
committerAlex Shi <alex.shi@linaro.org>
Fri, 8 Apr 2016 03:24:30 +0000 (11:24 +0800)
commitda978b6ea868b3b2e15025349be34282940039d9
tree21ecfa919b42b51978ba771598d6e5478ba13592
parent0ff7577f4fb24d42a34d33a0f16719b05328aa97
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>
(cherry picked from commit 0c717d0f9cb46259dce5272705adce64a2d646d9)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
drivers/base/power/opp/core.c