Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1204509

Re: [PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2()

From Stephen Boyd <sboyd@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2()
Date 2015-08-10 21:30 +0200
Message-ID <pW0VI-7eq-9@gated-at.bofh.it> (permalink)
References <pVOUy-6bs-7@gated-at.bofh.it> <pVOUy-6bs-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 08/10, Viresh Kumar wrote:
> 'dev_opp' will always be NULL in _of_init_opp_table_v2() after creating
> OPPs for a device. There is no point comparing it against NULL there.
> 
> Restructure code a bit to make it more efficient.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Curious if these are a response to the static checker mails? If
so it would be good to add a reported-by tag.

> ---
>  drivers/base/power/opp.c | 21 ++++++++++-----------
>  1 file changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
> index 1daaa1a418a2..c9747fb192b1 100644
> --- a/drivers/base/power/opp.c
> +++ b/drivers/base/power/opp.c
> @@ -1295,20 +1295,19 @@ static int _of_init_opp_table_v2(struct device *dev,
>  	if (WARN_ON(!count))
>  		goto out;
>  
> -	if (!ret) {
> -		if (!dev_opp) {
> -			dev_opp = _find_device_opp(dev);
> -			if (WARN_ON(!dev_opp))
> -				goto out;
> -		}
> -
> -		dev_opp->np = opp_np;
> -		dev_opp->shared_opp = of_property_read_bool(opp_np,
> -							    "opp-shared");
> -	} else {
> +	if (ret) {
>  		of_free_opp_table(dev);
> +		goto out;
>  	}
>  
> +	dev_opp = _find_device_opp(dev);
> +	if (WARN_ON(!dev_opp))
> +		goto out;

Doesn't ret = 0 in this case? Why not drop the goto and just
return some error code. Same for the goto out up above.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2() Viresh Kumar <viresh.kumar@linaro.org> - 2015-08-10 08:40 +0200
  Re: [PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2() Stephen Boyd <sboyd@codeaurora.org> - 2015-08-10 21:30 +0200
    Re: [PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2() Viresh Kumar <viresh.kumar@linaro.org> - 2015-08-11 02:30 +0200
      Re: [PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2() Stephen Boyd <sboyd@codeaurora.org> - 2015-08-11 02:40 +0200
        Re: [PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2() Viresh Kumar <viresh.kumar@linaro.org> - 2015-08-11 04:30 +0200
          Re: [PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2() Stephen Boyd <sboyd@codeaurora.org> - 2015-08-11 08:10 +0200
            Re: [PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2() Viresh Kumar <viresh.kumar@linaro.org> - 2015-08-11 09:00 +0200
              Re: [PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2() Viresh Kumar <viresh.kumar@linaro.org> - 2015-08-11 10:40 +0200
        Re: [PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2() Viresh Kumar <viresh.kumar@linaro.org> - 2015-08-11 04:40 +0200
          Re: [PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2() Stephen Boyd <sboyd@codeaurora.org> - 2015-08-11 08:10 +0200

csiph-web