From 2feb5a896c42fb24f6d6f7028574dc59bfc9306f Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Fri, 14 Dec 2018 15:20:56 +0530 Subject: OPP: Don't return 0 on error from of_get_required_opp_performance_state() of_get_required_opp_performance_state() returns 0 on errors currently and a positive performance state otherwise. Since 0 is a valid performance state (representing off), it would be better if this routine returns negative values on error. That will also make it behave similar to dev_pm_opp_xlate_performance_state(), which also returns performance states and returns negative values on error. Change the return type of the function to "int" in order to return negative values. This doesn't have any users for now and so no other part of the kernel will be impacted with this change. Reviewed-by: Ulf Hansson Signed-off-by: Viresh Kumar --- drivers/opp/of.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 7f09ae8fc050..fde324dd8c46 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -983,19 +983,19 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_sharing_cpus); * Returns the performance state of the OPP pointed out by the "required-opps" * property at @index in @np. * - * Return: Positive performance state on success, otherwise 0 on errors. + * Return: Zero or positive performance state on success, otherwise negative + * value on errors. */ -unsigned int of_get_required_opp_performance_state(struct device_node *np, - int index) +int of_get_required_opp_performance_state(struct device_node *np, int index) { struct dev_pm_opp *opp; struct device_node *required_np; struct opp_table *opp_table; - unsigned int pstate = 0; + int pstate = -EINVAL; required_np = of_parse_required_opp(np, index); if (!required_np) - return 0; + return -EINVAL; opp_table = _find_table_of_opp_np(required_np); if (IS_ERR(opp_table)) { -- cgit v1.2.3-59-g8ed1b