Re: [PATCH 3/7] cpufreq: qcom-cpufreq-nvmem: dev_pm_opp_put_*() accepts NULL argument
From: Ilia Lin
Date: Sun Nov 08 2020 - 04:27:52 EST
Reviewed-by: Ilia Lin <ilia.lin@xxxxxxxxxx>
On Fri, Nov 6, 2020 at 9:05 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
>
> The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so
> there is no need for us to carry the extra checks. Drop them.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> ---
> drivers/cpufreq/qcom-cpufreq-nvmem.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> index d06b37822c3d..747d602f221e 100644
> --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
> +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> @@ -397,19 +397,19 @@ static int qcom_cpufreq_probe(struct platform_device *pdev)
>
> free_genpd_opp:
> for_each_possible_cpu(cpu) {
> - if (IS_ERR_OR_NULL(drv->genpd_opp_tables[cpu]))
> + if (IS_ERR(drv->genpd_opp_tables[cpu]))
> break;
> dev_pm_opp_detach_genpd(drv->genpd_opp_tables[cpu]);
> }
> kfree(drv->genpd_opp_tables);
> free_opp:
> for_each_possible_cpu(cpu) {
> - if (IS_ERR_OR_NULL(drv->names_opp_tables[cpu]))
> + if (IS_ERR(drv->names_opp_tables[cpu]))
> break;
> dev_pm_opp_put_prop_name(drv->names_opp_tables[cpu]);
> }
> for_each_possible_cpu(cpu) {
> - if (IS_ERR_OR_NULL(drv->hw_opp_tables[cpu]))
> + if (IS_ERR(drv->hw_opp_tables[cpu]))
> break;
> dev_pm_opp_put_supported_hw(drv->hw_opp_tables[cpu]);
> }
> @@ -430,12 +430,9 @@ static int qcom_cpufreq_remove(struct platform_device *pdev)
> platform_device_unregister(cpufreq_dt_pdev);
>
> for_each_possible_cpu(cpu) {
> - if (drv->names_opp_tables[cpu])
> - dev_pm_opp_put_supported_hw(drv->names_opp_tables[cpu]);
> - if (drv->hw_opp_tables[cpu])
> - dev_pm_opp_put_supported_hw(drv->hw_opp_tables[cpu]);
> - if (drv->genpd_opp_tables[cpu])
> - dev_pm_opp_detach_genpd(drv->genpd_opp_tables[cpu]);
> + dev_pm_opp_put_supported_hw(drv->names_opp_tables[cpu]);
> + dev_pm_opp_put_supported_hw(drv->hw_opp_tables[cpu]);
> + dev_pm_opp_detach_genpd(drv->genpd_opp_tables[cpu]);
> }
>
> kfree(drv->names_opp_tables);
> --
> 2.25.0.rc1.19.g042ed3e048af
>